[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate - PythonExpr.py:1.1.2.5

Fred L. Drake, Jr. fdrake@acm.org
Wed, 27 Feb 2002 17:43:51 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate
In directory cvs.zope.org:/tmp/cvs-serv20748

Modified Files:
      Tag: Zope-3x-branch
	PythonExpr.py 
Log Message:
Clean up the weird "auto-construction" of the default getSecurityManager()
implementation.

=== Zope3/lib/python/Zope/PageTemplate/PythonExpr.py 1.1.2.4 => 1.1.2.5 ===
 from sys import exc_info
 
-class getSecurityManager:
+class NullSecurityManager:
     '''Null security manager'''
-    def validate(self, *args, **kwargs):
-        return 1
-    addContext = removeContext = validateValue = validate
+    def __init__(self):
+        self._stack = []
+    def validate(self, name, value):
+        pass
+    def validateValue(self, value):
+        pass
+    def pushExecutable(self, context):
+        self._stack.append(context)
+    def popExecutable(self):
+        self._stack.pop()
+
+def getSecurityManager(null_manager=NullSecurityManager()):
+    return null_manager
+
 
 class PythonExpr:
     def __init__(self, name, expr, engine):