[ZPT] CVS: Packages/Products/PageTemplates (Products/DC/PageTemplates) - PythonExpr.py:1.2 ZPythonExpr.py:1.2 ZRPythonExpr.py:1.2

evan@serenade.digicool.com evan@serenade.digicool.com
Thu, 24 May 2001 16:40:05 -0400


Update of /cvs-repository/Packages/Products/PageTemplates
In directory serenade:/home/evan/Zope/pt/lib/python/Products/PageTemplates

Modified Files:
	PythonExpr.py ZPythonExpr.py ZRPythonExpr.py 
Log Message:
Eliminate redundant security registration in PythonExprs.



--- Updated File PythonExpr.py in package Packages/Products/PageTemplates --
--- PythonExpr.py	2001/05/22 18:47:33	1.1
+++ PythonExpr.py	2001/05/24 20:40:04	1.2
@@ -130,6 +130,7 @@
         return names
 
     def __call__(self, econtext):
+        __traceback_info__ = self.expr
         f = self._f
         f.func_globals.update(self._bind_used_names(econtext))        
         return f()

--- Updated File ZPythonExpr.py in package Packages/Products/PageTemplates --
--- ZPythonExpr.py	2001/05/22 18:47:33	1.1
+++ ZPythonExpr.py	2001/05/24 20:40:04	1.2
@@ -110,20 +110,6 @@
         self._f = UntupleFunction(blk.t, guards, __builtins__=safebin)
         self._get_used_names()
 
-    def __call__(self, econtext):
-        f = self._f
-        f.func_globals.update(self._bind_used_names(econtext))
-        
-        # Execute the function in a new security context.
-        template = econtext.contexts['template']
-        security = getSecurityManager()
-        security.addContext(template)
-        try:
-            __traceback_info__ = self.expr
-            return f()
-        finally:
-            security.removeContext(template)
-
 class _SecureModuleImporter:
     __allow_access_to_unprotected_subobjects__ = 1
     def __getitem__(self, module):

--- Updated File ZRPythonExpr.py in package Packages/Products/PageTemplates --
--- ZRPythonExpr.py	2001/05/22 18:47:33	1.1
+++ ZRPythonExpr.py	2001/05/24 20:40:04	1.2
@@ -112,19 +112,11 @@
         self._code = code
         
     def __call__(self, econtext):
+        __traceback_info__ = self.expr
         code = self._code
         g = self._bind_used_names(econtext)
-        g.update(self._globals)
-        
-        # Execute the function in a new security context.
-        template = econtext.contexts['template']
-        security = getSecurityManager()
-        security.addContext(template)
-        try:
-            __traceback_info__ = self.expr
-            return eval(code, g, {})
-        finally:
-            security.removeContext(template)
+        g.update(self._globals)        
+        return eval(code, g, {})
 
 class _SecureModuleImporter:
     __allow_access_to_unprotected_subobjects__ = 1