Commit 0fadb843 authored by Jason Madden's avatar Jason Madden

Fix the last doctest errors in pure-python mode about parent circles. They...

Fix the last doctest errors in pure-python mode about parent circles. They were another manifestation of zopefoundation/ExtensionClass#3 and required a workaround.
parent 4053eadd
...@@ -628,7 +628,9 @@ class _Wrapper(ExtensionClass.Base): ...@@ -628,7 +628,9 @@ class _Wrapper(ExtensionClass.Base):
def __call__(self, *args, **kwargs): def __call__(self, *args, **kwargs):
try: 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: except AttributeError:
# A TypeError is what the interpreter raises; # A TypeError is what the interpreter raises;
# AttributeError is allowed to percolate through the # AttributeError is allowed to percolate through the
...@@ -656,6 +658,9 @@ class _Acquirer(ExtensionClass.Base): ...@@ -656,6 +658,9 @@ class _Acquirer(ExtensionClass.Base):
def __getattribute__(self, name): def __getattribute__(self, name):
try: try:
# workaround ExtensionClass bug #3
if name == '__parent__':
return object.__getattribute__(self, name)
return ExtensionClass.Base.__getattribute__(self, name) return ExtensionClass.Base.__getattribute__(self, name)
except AttributeError: except AttributeError:
# the doctests have very specific error message # the doctests have very specific error message
...@@ -828,7 +833,7 @@ def aq_inContextOf(self, o, inner=True): ...@@ -828,7 +833,7 @@ def aq_inContextOf(self, o, inner=True):
if 'PURE_PYTHON' not in os.environ: # pragma no cover if 'PURE_PYTHON' not in os.environ: # pragma no cover
try: try:
from _Acquisition import * from ._Acquisition import *
except ImportError: except ImportError:
pass pass
......
...@@ -2432,7 +2432,8 @@ def test___parent__aq_parent_circles(): ...@@ -2432,7 +2432,8 @@ def test___parent__aq_parent_circles():
>>> x.__parent__.aq_base is y.aq_base >>> x.__parent__.aq_base is y.aq_base
True True
>>> Acquisition.aq_parent(x) is y
True
>>> x.__parent__.__parent__ is x >>> x.__parent__.__parent__ is x
True True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment