[Checkins] SVN: Zope/branches/philikon-aq-and-__parent__/lib/python/Shared/DC/Scripts/Bindings.py Read that mail again, we agreed on raising an AttributeError instead of returning None.

Hanno Schlichting plone at hannosch.info
Sun Jun 24 20:14:55 EDT 2007


Log message for revision 77024:
  Read that mail again, we agreed on raising an AttributeError instead of returning None.
  

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

-=-
Modified: Zope/branches/philikon-aq-and-__parent__/lib/python/Shared/DC/Scripts/Bindings.py
===================================================================
--- Zope/branches/philikon-aq-and-__parent__/lib/python/Shared/DC/Scripts/Bindings.py	2007-06-25 00:01:39 UTC (rev 77023)
+++ Zope/branches/philikon-aq-and-__parent__/lib/python/Shared/DC/Scripts/Bindings.py	2007-06-25 00:14:53 UTC (rev 77024)
@@ -172,13 +172,6 @@
     __allow_access_to_unprotected_subobjects__ = 1
     __roles__ = _what_not_even_god_should_do
 
-    # Acquisition will nowadays try to do an getattr on all objects which
-    # aren't Acquisition wrappers, asking for a __parent__ pointer. We need
-    # to provide a fake one, or our normal __getattr__ method will be used
-    # and fail as __parent__ starts with a __.
-
-    __parent__ = None
-
     def __repr__(self):
         return '<UnauthorizedBinding: %s>' % self._name
 
@@ -186,6 +179,12 @@
         # Make *extra* sure that the wrapper isn't used to access
         # __call__, etc.
         if name.startswith('__'):
+            # Acquisition will nowadays try to do an getattr on all objects which
+            # aren't Acquisition wrappers, asking for a __parent__ pointer. We
+            # don't want to fail in this case but simply raise an AttributeError.
+            if name in ('__parent__', '__name__'):
+                raise AttributeError
+
             self.__you_lose()
 
         return guarded_getattr(self._wrapped, name, default)



More information about the Checkins mailing list