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

Modified Files:
      Tag: tseaver-hasattr_geddon-branch
        Guards.py 
Log Message:

  - Removed all uses of the 'hasattr' builtin from the core, where
    the object being tested derives (or might) from Persistent.
    XXX:  currently, this branch imports a 'safe_hasattr' from ZODB.utils,
    which adds a dependency on ZODB for some packages;  we probably
    need a better location, and perhas a C implementation?


=== Packages/RestrictedPython/Guards.py 1.9.2.5 => 1.9.2.5.28.1 ===
--- Packages/RestrictedPython/Guards.py:1.9.2.5 Thu Jan  8 18:33:56 2004
+++ Packages/RestrictedPython/Guards.py Sat May 28 20:41:35 2005
@@ -13,6 +13,7 @@
 __version__='$Revision$'[11:-2]
 
 import exceptions
+from ZODB.utils import safe_hasattr
 
 # This tiny set of safe builtins is extended by users of the module.
 # AccessControl.ZopeGuards contains a large set of wrappers for builtins.
@@ -120,7 +121,7 @@
     def guard(ob):
         # 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'):
+        if safetype(type(ob)) or safe_hasattr(ob, '_guarded_writes'):
             return ob
         # Hand the object to the Wrapper instance, then return the instance.
         return Wrapper(ob)

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to