[Zope3-dev] Re: ObjectMover events
Florent Guillaume
fg at nuxeo.com
Thu Dec 1 10:23:52 EST 2005
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
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope3-dev
mailing list