[Zope-dev] zope.traversing's ILocation behavior
Roger
dev at projekt01.ch
Fri Jul 9 06:49:00 EDT 2010
Hi all
> Betreff: Re: [Zope-dev] zope.traversing's ILocation behavior
>
>
> On Jul 8, 2010, at 11:04 AM, Martijn Faassen wrote:
> >
> > I propose the following adjustment:
> >
> > try:
> > container = context.__parent__
> > except AttributeError:
> > container = ILocation(context).__parent__
I'm fine with that too. But this will skip the __conform__
lookup, right?
See: zope/interface/interfaces.py line: 167
--------
class InterfaceBasePy(object):
"""Base class that wants to be replaced with a C base :)
"""
def __call__(self, obj, alternate=_marker):
"""Adapt an object to the interface
"""
conform = getattr(obj, '__conform__', None)
if conform is not None:
adapter = self._call_conform(conform)
if adapter is not None:
return adapter
adapter = self.__adapt__(obj)
if adapter is not None:
return adapter
elif alternate is not _marker:
return alternate
else:
raise TypeError("Could not adapt", obj, self)
--------
But anyway, also the initial implementation which we
used a long time whould skip such __conform__ call.
In my point of view is the usage of the absoluteURL
method an explicit pypass of the ILocation adaption
and an improved speedup lookup based on the directly
__parent__ attribute access. Probably we should add
a comment about that in the absoluteURL method.
Regards
Roger Ineichen
More information about the Zope-Dev
mailing list