[Zope-Checkins] SVN: Zope/branches/philikon-aq/lib/python/Shared/DC/Scripts/Bindings.py Use the canonical form for getting to an object's innermost wrapper

Philipp von Weitershausen philikon at philikon.de
Fri Jul 27 20:06:09 EDT 2007


Log message for revision 78403:
  Use the canonical form for getting to an object's innermost wrapper
  and an object's parent by usingn the aq_parent and aq_inner *functions*,
  not attributes.
  

Changed:
  U   Zope/branches/philikon-aq/lib/python/Shared/DC/Scripts/Bindings.py

-=-
Modified: Zope/branches/philikon-aq/lib/python/Shared/DC/Scripts/Bindings.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Shared/DC/Scripts/Bindings.py	2007-07-27 23:45:05 UTC (rev 78402)
+++ Zope/branches/philikon-aq/lib/python/Shared/DC/Scripts/Bindings.py	2007-07-28 00:06:09 UTC (rev 78403)
@@ -20,6 +20,7 @@
 from AccessControl.PermissionRole import _what_not_even_god_should_do
 from AccessControl.ZopeGuards import guarded_getattr
 from Persistence import Persistent
+from Acquisition import aq_parent, aq_inner
 from string import join, strip
 import re
 
@@ -271,11 +272,11 @@
     def _getContext(self):
         # Utility for bindcode.
         while 1:
-            self = self.aq_parent
+            self = aq_parent(self)
             if not getattr(self, '_is_wrapperish', None):
-                parent = getattr(self, 'aq_parent', None)
-                inner = getattr(self, 'aq_inner', None)
-                container = getattr(inner, 'aq_parent', None)
+                parent = aq_parent(self)
+                inner = aq_inner(self)
+                container = aq_parent(inner)
                 try: getSecurityManager().validate(parent, container, '', self)
                 except Unauthorized:
                     return UnauthorizedBinding('context', self)
@@ -284,11 +285,11 @@
     def _getContainer(self):
         # Utility for bindcode.
         while 1:
-            self = self.aq_inner.aq_parent
+            self = aq_parent(aq_inner(self))
             if not getattr(self, '_is_wrapperish', None):
-                parent = getattr(self, 'aq_parent', None)
-                inner = getattr(self, 'aq_inner', None)
-                container = getattr(inner, 'aq_parent', None)
+                parent = aq_parent(self)
+                inner = aq_inner(self)
+                container = aq_parent(inner)
                 try: getSecurityManager().validate(parent, container, '', self)
                 except Unauthorized:
                     return UnauthorizedBinding('container', self)



More information about the Zope-Checkins mailing list