[Zope3-dev] Container interface issues

Jim Fulton jim at zope.com
Wed Sep 10 10:54:27 EDT 2003


Anthony Baxter wrote:
>>>>Jim Fulton wrote
>>
>>I proposed that application code, rather than containers, be
>>responsible for generating events and calling necessary hooks when
>>adding or removing objects.  
> 
> 
> I understand the rationale for it (indeed, I can't see a better way) but
> this makes me uneasy. In the process of hooking up the catalog I found a
> number of existing places that were not Doing The Right Thing with event
> generation - making more places to do this Would Be Bad. Tracking down
> missing event generation stuff also sucks - things are just wacky, and
> it takes some time to find the problem.

I suspect that this would be almost as likely of Doing The Right Thing
was the container's responsibility.

I think we can arrange for making Doing The Right Thing easier.  For example,
instead of:

   container.setObject(name, object)

people will use:

   zapi.add(container, name, object)

I think that these are of comparable difficulty.

The problem remains that people who implement containers
will be aware of setObject and be tempted to use it.

> I wonder if we could do something where _in_ _addition_ to the
> object delete and object add events (generated by the container) the
> application code could also flag a 'move' event. Then (assuming some
> magic handwaving) the event service notices that it's got a move, add
> and del event for the same object, and coalesces them into a move event?
> 
> Just-thinking-out-loud-ly yrs,

This sounds too magic to me, and pretty hard to get right. It also
doesn't help the hook situation. Different hooks need to get called
for copying and moving.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (703) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list