Skip to content

Commit

Permalink
Fix the last doctest errors in pure-python mode about parent circles.…
Browse files Browse the repository at this point in the history
… They were another manifestation of zopefoundation/ExtensionClass#3 and required a workaround.
  • Loading branch information
jamadden committed Mar 20, 2015
1 parent 4053ead commit 0fadb84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Acquisition/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ def __getitem__(self, key):

def __call__(self, *args, **kwargs):
try:
call = getattr(type(self._obj), '__call__')
# Note we look this up on the completely unwrapped
# object, so as not to get a class
call = getattr(self.aq_base, '__call__')
except AttributeError:
# A TypeError is what the interpreter raises;
# AttributeError is allowed to percolate through the
Expand Down Expand Up @@ -656,6 +658,9 @@ class _Acquirer(ExtensionClass.Base):

def __getattribute__(self, name):
try:
# workaround ExtensionClass bug #3
if name == '__parent__':
return object.__getattribute__(self, name)
return ExtensionClass.Base.__getattribute__(self, name)
except AttributeError:
# the doctests have very specific error message
Expand Down Expand Up @@ -828,7 +833,7 @@ def aq_inContextOf(self, o, inner=True):

if 'PURE_PYTHON' not in os.environ: # pragma no cover
try:
from _Acquisition import *
from ._Acquisition import *
except ImportError:
pass

Expand Down
3 changes: 2 additions & 1 deletion src/Acquisition/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,8 @@ def test___parent__aq_parent_circles():
>>> x.__parent__.aq_base is y.aq_base
True
>>> Acquisition.aq_parent(x) is y
True
>>> x.__parent__.__parent__ is x
True
Expand Down

0 comments on commit 0fadb84

Please sign in to comment.