[Zope-Checkins] CVS: Zope/lib/python/RestrictedPython - Guards.py:1.6

Ken Manheimer klm@zope.com
Tue, 16 Oct 2001 11:28:49 -0400


Update of /cvs-repository/Zope/lib/python/RestrictedPython
In directory cvs.zope.org:/tmp/cvs-serv26348

Modified Files:
	Guards.py 
Log Message:
Merging (apparent) nested-scopes problem workaround from
Zope-2_4-branch.


=== Zope/lib/python/RestrictedPython/Guards.py 1.5 => 1.6 ===
     # safetype variable is used by guard()
     safetype = {type(()): 1, type([]): 1, type({}): 1, type(''): 1}.has_key
-    def guard(ob, write=None):
+    def guard(ob, write=None, safetype=safetype):
         # Don't bother wrapping simple types, or objects that claim to
         # handle their own read security.
         if safetype(type(ob)) or getattr(ob, '_guarded_reads', 0):
@@ -165,7 +165,7 @@
     # safetype and Wrapper variables are used by guard()
     safetype = {type([]): 1, type({}): 1}.has_key
     Wrapper = _write_wrapper()
-    def guard(ob):
+    def guard(ob, safetype=safetype, Wrapper=Wrapper):
         # Don't bother wrapping simple types, or objects that claim to
         # handle their own write security.
         if safetype(type(ob)) or hasattr(ob, '_guarded_writes'):