[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/container/constraints.py Updated more of the container-constraint code to take advantage of

Jim Fulton jim at zope.com
Tue Jun 22 12:31:56 EDT 2004


Log message for revision 25937:
Updated more of the container-constraint code to take advantage of
attribute-information caching in declarations.



-=-
Modified: Zope3/trunk/src/zope/app/container/constraints.py
===================================================================
--- Zope3/trunk/src/zope/app/container/constraints.py	2004-06-22 15:52:49 UTC (rev 25936)
+++ Zope3/trunk/src/zope/app/container/constraints.py	2004-06-22 16:29:47 UTC (rev 25937)
@@ -201,18 +201,17 @@
                     return False
 
     # check the constraint on __parent__
-    for iface in factory.getInterfaces():
-        __parent__ = iface.get('__parent__')
-        if __parent__ is not None:
+    __parent__ = factory.getInterfaces().get('__parent__')
+    if __parent__ is not None:
+        try:
+            validate = __parent__.validate
+        except AttributeError:
+            pass
+        else:
             try:
-                validate = __parent__.validate
-            except AttributeError:
-                pass
-            else:
-                try:
-                    validate(container)
-                except zope.interface.Invalid:
-                    return False
+                validate(container)
+            except zope.interface.Invalid:
+                return False
 
     return True
 




More information about the Zope3-Checkins mailing list