15 |
# You should have received a copy of the GNU General Public License |
# You should have received a copy of the GNU General Public License |
16 |
# along with this program; if not, write to the Free Software |
# along with this program; if not, write to the Free Software |
17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
18 |
|
__version__='$Revision$'[11:-2] |
19 |
|
|
20 |
from Products.CMFCore import FSPageTemplate as cmfFSPT |
from Products.CMFCore import FSPageTemplate as cmfFSPT |
21 |
from Products.CMFCore.FSPageTemplate import * |
from Products.CMFCore.FSPageTemplate import * |
22 |
from ZOPT import ZopePageTemplate, compiler_registry |
from OpenPTBase import OpenPageTemplate, compiler_registry |
23 |
|
from ZOPT import ZopePageTemplate # for zodb clones |
24 |
from Products.CMFCore import utils |
from Products.CMFCore import utils |
25 |
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
26 |
import Globals, AccessControl |
import Globals, AccessControl |
37 |
except KeyError: |
except KeyError: |
38 |
raise NameError, name |
raise NameError, name |
39 |
|
|
40 |
class FSPageTemplate(ZopePageTemplate, FSObject, Script): |
class FSPageTemplate(OpenPageTemplate, FSObject): |
41 |
"Wrapper for Page Template" |
"CMF FSObject Wrapper for Open Page Template" |
42 |
|
|
43 |
meta_type = 'Filesystem Page Template (OpenPT)' |
meta_type = 'Filesystem Page Template (OpenPT)' |
44 |
_icon = 'misc_/OpenPT/fsopt.png' |
_icon = 'misc_/OpenPT/fsopt.png' |
71 |
|
|
72 |
def __init__(self, id, filepath, fullname=None, properties=None): |
def __init__(self, id, filepath, fullname=None, properties=None): |
73 |
FSObject.__init__(self, id, filepath, fullname, properties) |
FSObject.__init__(self, id, filepath, fullname, properties) |
74 |
|
OpenPageTemplate.__init__(self, id) |
75 |
self.ZBindings_edit(self._default_bindings) |
self.ZBindings_edit(self._default_bindings) |
76 |
self.macros = MacroCollection() |
self.macros = MacroCollection() |
77 |
self.macros.__roles__ = None |
self.macros.__roles__ = None |
78 |
self.macros.__allow_access_to_unprotected_subobjects__ = 1 |
self.macros.__allow_access_to_unprotected_subobjects__ = 1 |
79 |
|
|
|
def manage_afterAdd(self, item, container): |
|
|
# do nothing here for FSObjects |
|
|
pass |
|
|
|
|
80 |
def _createZODBClone(self): |
def _createZODBClone(self): |
81 |
"""Create a ZODB (editable) equivalent of this object.""" |
"""Create a ZODB (editable) equivalent of this object.""" |
82 |
t = ZopePageTemplate(self.getId(), self.read()) |
t = ZopePageTemplate(self.getId(), self.read()) |
83 |
t.handlers = self.handlers |
t.handlers = self.handlers |
84 |
return t |
return t |
85 |
|
|
86 |
|
# unneeded, since this doesn't inherit from Cacheable, but won't hurt |
87 |
def ZCacheable_isCachingEnabled(self): |
def ZCacheable_isCachingEnabled(self): |
88 |
return 0 |
return 0 |
89 |
|
|
114 |
def read(self): |
def read(self): |
115 |
# Tie in on an opportunity to auto-update |
# Tie in on an opportunity to auto-update |
116 |
self._updateFromFS() |
self._updateFromFS() |
117 |
return ZopePageTemplate.read(self) |
return OpenPageTemplate.read(self) |
118 |
|
|
119 |
def paxtree(self): |
def paxtree(self): |
120 |
'fetch the pax tree from the zodb' |
'fetch the pax tree from the zodb' |
121 |
if self._compiled != repr(compiler_registry): |
if self._compiled != repr(compiler_registry): |
122 |
self._parsed = None |
self._parsed = None |
123 |
self._updateFromFS() |
self._updateFromFS() |
124 |
return ZopePageTemplate.paxtree(self) |
return OpenPageTemplate.paxtree(self) |
|
|
|
|
|
|
125 |
Globals.InitializeClass(FSPageTemplate) |
Globals.InitializeClass(FSPageTemplate) |
126 |
#cmfFSPT.FSPageTemplate = FSPageTemplate |
#cmfFSPT.FSPageTemplate = FSPageTemplate |
127 |
|
|