Re: zope.traversing's ILocation behavior

"Roger" <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <201007091230732.SM02628@mobile05>
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

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.