Commit ea3765d4 authored by Evan Simpson's avatar Evan Simpson

Merge bugfixes from zpt-1_4_0

parent 7cbbf24c
......@@ -89,7 +89,7 @@ Page Template-specific implementation of TALES, with handlers
for Python expressions, string literals, and paths.
"""
__version__='$Revision: 1.21 $'[11:-2]
__version__='$Revision: 1.22 $'[11:-2]
import re, sys
from TALES import Engine, CompilerError, _valid_name, NAME_RE, \
......@@ -125,6 +125,7 @@ if sys.modules.has_key('Zope'):
else:
from ZPythonExpr import PythonExpr, _SecureModuleImporter, \
call_with_ns
SecureModuleImporter = _SecureModuleImporter()
else:
from PythonExpr import getSecurityManager, PythonExpr
def call_with_ns(f, ns, arg=1):
......
......@@ -4,6 +4,22 @@ Page Template history
PageTemplates. Change information for the current release can be found
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
......
......@@ -87,7 +87,7 @@
Zope object encapsulating a Page Template from the filesystem.
"""
__version__='$Revision: 1.4 $'[11:-2]
__version__='$Revision: 1.5 $'[11:-2]
import os, AccessControl, Acquisition, sys
from Globals import package_home, DevelopmentMode
......@@ -98,8 +98,14 @@ from Shared.DC.Scripts.Signature import FuncCode
from AccessControl import getSecurityManager
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 @@ class PageTemplateFile(Script, PageTemplate, Traversable):
func_code = FuncCode((), 0)
_need__name__=1
_v_last_read=0
macros = MacroCollection()
_default_bindings = {'name_subpath': 'traverse_subpath'}
......@@ -125,9 +132,9 @@ class PageTemplateFile(Script, PageTemplate, Traversable):
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):
......
......@@ -87,7 +87,7 @@
Zope object encapsulating a Page Template.
"""
__version__='$Revision: 1.19 $'[11:-2]
__version__='$Revision: 1.20 $'[11:-2]
import os, AccessControl, Acquisition, sys
from Globals import DTMLFile, MessageDialog, package_home
......@@ -104,6 +104,8 @@ from OFS.Traversable import Traversable
from OFS.PropertyManager import PropertyManager
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 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
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 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
'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 @@ class Src(Acquisition.Explicit):
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 @@ def manage_addPageTemplate(self, id, title=None, text=None,
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',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment