[Zope3-checkins] CVS: Zope3/src/zope/security - checker.py:1.36

Jim Fulton jim@zope.com
Sun, 22 Jun 2003 20:04:28 -0400


Update of /cvs-repository/Zope3/src/zope/security
In directory cvs.zope.org:/tmp/cvs-serv13692/zope/security

Modified Files:
	checker.py 
Log Message:
When iterating over security-proxied sequences, Python failed to
recognize a ForbiddenAttributeError as an AttributeError. To work
around this, we now don't raise a ForbiddenAttribute for __iter__ if
the object doesn't have an __iter__ attribute.


=== Zope3/src/zope/security/checker.py 1.35 => 1.36 ===
--- Zope3/src/zope/security/checker.py:1.35	Sun Jun 22 16:40:11 2003
+++ Zope3/src/zope/security/checker.py	Sun Jun 22 20:03:57 2003
@@ -168,8 +168,9 @@
         elif name in _always_available:
             return
 
-        __traceback_supplement__ = (TracebackSupplement, object)
-        raise ForbiddenAttribute, name
+        if name != '__iter__' or hasattr(object, name):
+            __traceback_supplement__ = (TracebackSupplement, object)
+            raise ForbiddenAttribute, name
 
     def proxy(self, value):
         'See IChecker'