[CMF-checkins] CVS: CMF - Expression.py:1.4

shane@digicool.com shane@digicool.com
Thu, 21 Jun 2001 16:05:21 -0400 (EDT)


Update of /cvs-repository/CMF/DCWorkflow
In directory korak.digicool.com:/tmp/cvs-serv468

Modified Files:
	Expression.py 
Log Message:
Used the new Zope 2.4.x method of implementing DTML security.



--- Updated File Expression.py in package CMF --
--- Expression.py	2001/06/13 02:06:20	1.3
+++ Expression.py	2001/06/21 20:05:21	1.4
@@ -104,12 +104,12 @@
 
 try:
     # Zope 2.4.x
-    from AccessControl import full_read_guard
+    from AccessControl.DTML import RestrictedDTML
 except ImportError:
-    full_read_guard = None
+    class RestrictedDTML: pass
 
 
-class Expression (Persistent):
+class Expression (Persistent, RestrictedDTML):
     text = ''
     _v_eval = None
 
@@ -128,11 +128,6 @@
         # Zope 2.3.x
         return getSecurityManager().validate(inst, parent, name, value)
 
-    security.declarePrivate('read_guard')
-    def read_guard(self, ob):
-        # Zope 2.4.x
-        return full_read_guard(ob)
-
     def __call__(self, md):
         # md is a TemplateDict instance.
         eval = self._v_eval
@@ -144,7 +139,9 @@
                 eval = Eval(text)
             self._v_eval = eval
         md.validate = self.validate  # Zope 2.3.x
-        md.read_guard = self.read_guard  # Zope 2.4.x
+        # Zope 2.4.x
+        md.guarded_getattr = getattr(self, 'guarded_getattr', None)
+        md.guarded_getitem = getattr(self, 'guarded_getitem', None)
         return eval.eval(md)
 
 Globals.InitializeClass(Expression)