[Zope3-dev] RE: ObjectMover events

Roger Ineichen dev at projekt01.ch
Thu Dec 1 11:07:54 EST 2005


Hi Florent


> -----Original Message-----
> From: Florent Guillaume [mailto:fg at nuxeo.com] 
> Sent: Thursday, December 01, 2005 4:24 PM
> To: dev at projekt01.ch
> Cc: zope3-dev
> Subject: Re: ObjectMover events
> 
> Florent Guillaume wrote:
> >> I dont' know if this affect the events itself but there is also a 
> >> problem in the ObjectMover.
> >>
> >> If you use the ObjectMover from copypastemove on IDependable 
> >> (registered) objects, it's not possible to move a object 
> because of 
> >> the order the move process is implemented.
> >>
> >> ---
> >> target[new_name] = obj
> >> del container[orig_name]
> > 
> > 
> > Doh. I hadn't looked at that code.
> > 
> >> if the ObjectAdded Event will add a dependency to the 
> object we can't 
> >> delete them in the container.
> >>
> >> If this should be fixed, I'm not sure if the ObjectMover 
> should copy
> >> dependable objects, then the order should be:
> >>
> >> ---
> >> del container[orig_name]
> >> target[new_name] = obj
> >>
> >>
> >> This means the events order in this usecase looks like:
> >>
> >> IObjectRemovedEvent
> >> IObjectAddedEvent
> >> IObjectMovedEvent
> >>
> >> Where the IObjectMovedEvent notifies about the sucessful move.
> >> Anyway, add a object to a container where is at the same time in
> >> a second container is a bad idea in my point of view.
> > 
> > 
> > I think ObjectMover doesn't care about events but it 
> should. It should 
> > do whatever is necessary so that only one IObjectMovedEvent is 
> > generated. I'll look at that.
> 
> Actually the ObjectMover code is correct, it doesn't send the 
> events you say 
> it sends. I added a test for this:
> http://svn.zope.org/?rev=40445&view=rev
> 
> Florent

Yes, that's correct. 

Sorry I wasn't clear. I was describing another problem
only indirect related to events. The ObjectMover itself doesn't 
send events. 

My problem is, that the ObjectMover doesn't work with objects 
where have adependency (IDependable), because the order is wrong 
how they copy objects.

This produce a mess with the __parent__:
----
target[new_name] = obj
del container[orig_name]
----


I really prefere this:
-----
del container[orig_name]
target[new_name] = obj
-----

What do you think?


Regards
Roger Ineichen



More information about the Zope3-dev mailing list