[ZPT] CVS: Products/PageTemplates - Expressions.py:1.22 HISTORY.txt:1.5 PageTemplateFile.py:1.5 ZopePageTemplate.py:1.20
Evan Simpson
evan@zope.com
Mon, 15 Oct 2001 10:05:05 -0400
Update of /cvs-repository/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv27099
Modified Files:
Expressions.py HISTORY.txt PageTemplateFile.py
ZopePageTemplate.py
Log Message:
Merge bugfixes from zpt-1_4_0
=== Products/PageTemplates/Expressions.py 1.21 => 1.22 ===
from ZPythonExpr import PythonExpr, _SecureModuleImporter, \
call_with_ns
+ SecureModuleImporter = _SecureModuleImporter()
else:
from PythonExpr import getSecurityManager, PythonExpr
def call_with_ns(f, ns, arg=1):
=== Products/PageTemplates/HISTORY.txt 1.4 => 1.5 ===
in the file CHANGES.txt.
+ Version 1.4.1
+
+ Bugs Fixed
+
+ - Tracebacks were often truncated.
+
+ - __bobo_traverse__ objects, such as the root, triggered
+ security incorrectly when traversed.
+
+ - If a PageTemplate was owned by a missing user, or one with
+ insufficient permissions, the editing form broke.
+
+ - PageTemplateFiles didn't bind 'user'.
+
+ - There was no help.
+
Version 1.4.0
Features Added
=== Products/PageTemplates/PageTemplateFile.py 1.4 => 1.5 ===
from OFS.Traversable import Traversable
from PageTemplate import PageTemplate
-from ZopePageTemplate import SecureModuleImporter
+from Expressions import SecureModuleImporter
from ComputedAttribute import ComputedAttribute
+from ExtensionClass import Base
+
+class MacroCollection(Base):
+ def __of__(self, parent):
+ parent._cook_check()
+ return parent._v_macros
class PageTemplateFile(Script, PageTemplate, Traversable):
"Zope wrapper for filesystem Page Template using TAL, TALES, and METAL"
@@ -110,6 +116,7 @@
func_code = FuncCode((), 0)
_need__name__=1
_v_last_read=0
+ macros = MacroCollection()
_default_bindings = {'name_subpath': 'traverse_subpath'}
@@ -125,9 +132,9 @@
elif type(_prefix) is not type(''):
_prefix = package_home(_prefix)
name = kw.get('__name__')
- if not name:
- name = os.path.split(filename)[-1]
- self.__name__ = name
+ if name:
+ self._need__name__ = 0
+ self.__name__ = name
self.filename = filename = os.path.join(_prefix, filename + '.zpt')
def pt_getContext(self):
=== Products/PageTemplates/ZopePageTemplate.py 1.19 => 1.20 ===
from PageTemplate import PageTemplate
from TALES import TALESError
+from Expressions import SecureModuleImporter
+from PageTemplateFile import PageTemplateFile
try:
from webdav.Lockable import ResourceLockedError
@@ -124,12 +126,13 @@
func_defaults = None
func_code = FuncCode((), 0)
- _default_bindings = {'name_subpath': 'traverse_subpath'}
+ _default_bindings = {}
_default_content_fn = os.path.join(package_home(globals()),
'www', 'default.html')
manage_options = (
- {'label':'Edit', 'action':'pt_editForm'},
+ {'label':'Edit', 'action':'pt_editForm',
+ 'help': ('PageTemplates', 'PageTemplate_Edit.stx')},
{'label':'Test', 'action':'ZScriptHTML_tryForm'},
) + PropertyManager.manage_options \
+ Historical.manage_options \
@@ -162,6 +165,11 @@
'ZScriptHTML_tryForm', 'PrincipiaSearchSource',
'document_src', 'source.html', 'source.xml')
+ pt_editForm = PageTemplateFile('www/ptEdit', globals(),
+ __name__='pt_editForm')
+ pt_editForm._owner = None
+ manage = manage_main = pt_editForm
+
security.declareProtected('Change Page Templates',
'pt_editAction', 'pt_setTitle', 'pt_edit',
'pt_upload', 'pt_changePrefs')
@@ -335,10 +343,9 @@
d = ZopePageTemplate.__dict__
d['source.xml'] = d['source.html'] = Src()
-from Expressions import _SecureModuleImporter
-SecureModuleImporter = _SecureModuleImporter()
-
# Product registration and Add support
+manage_addPageTemplateForm = PageTemplateFile('www/ptAdd', globals())
+
from urllib import quote
def manage_addPageTemplate(self, id, title=None, text=None,
@@ -368,16 +375,7 @@
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''
-#manage_addPageTemplateForm = DTMLFile('dtml/ptAdd', globals())
-
def initialize(context):
- from PageTemplateFile import PageTemplateFile
- manage_addPageTemplateForm = PageTemplateFile('www/ptAdd', globals())
- _editForm = PageTemplateFile('www/ptEdit', globals())
- ZopePageTemplate.manage = _editForm
- ZopePageTemplate.manage_main = _editForm
- ZopePageTemplate.pt_editForm = _editForm
- _editForm._owner = None
context.registerClass(
ZopePageTemplate,
permission='Add Page Templates',