[Zope3-dev] interaction between LocationProxy and IIntId utility

Jim Fulton jim at zope.com
Thu Jul 7 14:12:10 EDT 2005


Jim Fulton wrote:
> Martijn Faassen wrote:
> 
...

> If an object doesn't participate in the location framework, then we have to
> create a second object that provides location, the ContainedProxy.
> There are really two distinct objects.  You want the intid to point to
> the proxy, so you get the location information.  The content object knows
> nothing about the proxy, so it can't generate events about the proxy.
> 
> My suggestion is to do one of:
> 
> - Implement ILocation in your content objects.  This is the
>   simplest course. It sounds like, for your application, the content
>   objects should know about their locations, since you want them
>   to be able to generate events that contain location information.
> 
>   or
> 
> - Don't generate events amout the located objects (e.g. modification
>   events) from within content object methods. The content objects
>   don't have enough information. Rather, generate the events from views
>   on the objects obtained from the container.

Another option that might work is to provide an adapter from
ContainedProxy to IKeyReference that compares, and hashes based on
the key reference to the underlying object.  This would case the
ContainedProxy and the object it proxies to have the same intid.
It requires that the ContainedProxy be registered with the intid,
not the proxied object.

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