[Zope-Checkins]
SVN: Products.Five/branches/ajung-zpt-end-game/browser/pagetemplatefile.py
Use "trusted" expression engine with non-restricted python
expressions.
Philipp von Weitershausen
philikon at philikon.de
Tue May 9 06:22:42 EDT 2006
Log message for revision 68060:
Use "trusted" expression engine with non-restricted python expressions.
Changed:
U Products.Five/branches/ajung-zpt-end-game/browser/pagetemplatefile.py
-=-
Modified: Products.Five/branches/ajung-zpt-end-game/browser/pagetemplatefile.py
===================================================================
--- Products.Five/branches/ajung-zpt-end-game/browser/pagetemplatefile.py 2006-05-09 10:22:04 UTC (rev 68059)
+++ Products.Five/branches/ajung-zpt-end-game/browser/pagetemplatefile.py 2006-05-09 10:22:42 UTC (rev 68060)
@@ -20,10 +20,15 @@
from Globals import package_home
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.PageTemplates.Expressions import SecureModuleImporter
+from Products.PageTemplates.Expressions import createTrustedZopeEngine
from zope.app.pagetemplate.viewpagetemplatefile import ViewMapper
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+_engine = createTrustedZopeEngine()
+def getEngine():
+ return _engine
+
class ZopeTwoPageTemplateFile(PageTemplateFile):
"""A strange hybrid between Zope 2 and Zope 3 page template.
@@ -44,14 +49,8 @@
basepath, ext = os.path.splitext(self.filename)
self.__name__ = os.path.basename(basepath)
+ super(PageTemplateFile, self).__init__(self.filename, _prefix)
- # required for the ajung-zpt-final-integration branch
- try:
- PageTemplateFile.__init__(self, self.filename, _prefix)
- except:
- pass
-
-
def get_path_from_prefix(self, _prefix):
if isinstance(_prefix, str):
path = _prefix
@@ -61,6 +60,9 @@
path = package_home(_prefix)
return path
+ def pt_getEngine(self):
+ return getEngine()
+
def pt_getContext(self):
try:
root = self.getPhysicalRoot()
More information about the Zope-Checkins
mailing list