[Zope3-dev] Backward-incompatible bug fix to zope.proxy

Jim Fulton jim at zope.com
Mon Apr 3 06:15:12 EDT 2006


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:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list