Roger Ineichen wrote:
Jim Fulton schrieb:
[...]

Hi Jim,

We just use a IContainer location proxy adapter.
But since this adapter isn't persistent I don't think this
is a problem.

def proxify(container, item):
    if IContainer.providedBy(item):
        proxy = ContainerLocationProxy(item)
    else:
        proxy = LocationProxy(item)
    proxy.__name__ = item.__name__
    proxy.__parent__ = container
    return proxy

class ContainerLocationProxy(LocationProxy):
    """Proxy the location of a container an its items."""

    # zope.app.conatiner.interfaces.IReadContainer
    def __getitem__(self, key):
        return proxify(self, getProxiedObject(self).__getitem__(key))

    ...


Well, with the fix, your __getitem__ won't be called. Is that a
problem? ;)

You will need to use the @non_overridable decorator on your __getitem__
function.


If I understand this correctly, then we only have to update the methods with decorators?

I believe so.

If so, this will be fine for me.

Cool.

Jim

--
Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to