Hi,
I found something strange in metadata when copying a persistent object.
My situation is the following: I have a container with some elements inside. I create a copy of this container using
zope.copypastemove.ObjectCopier(my_container).copyTo(my_container.__parent__)
(Actually I use zope.copypastemove.interfaces.IObjectCopier(my_container) but this calls the adapter mentioned above.)
Side note: Is this the right way to copy an persistent object nowadays?
This happens tho dublin core metadata then: As zope.dublincore.timeannotators.CreatedAnnotator is subscribed to zope.lifecycleevent.IObjectCreatedEvent it gets called as the ObjectCopiedEvent is a subclass of ObjectCreatedEvent. The copy of the container gets a new creation date set in its metadata.
But zope.copypastemove.dispatchToSublocations calls the subscribers for the sublocations using zope.component.subscribers((sub, event), None)
So the zope.dublincore.timeannotators.CreatedAnnotator does not get called as it is not registered for (object, event) but only for (event,).
This leads to a strange situation: the metadata of the copied container get updated but not the metadata of its contents. This behavior has not changed since version 3.4.0 which was about 2,5 years ago.
I think this is a long-standing bug and it should it be fixed in zope.dublincore by registering the subscribers for (object, event)? (Additionally or exclusively, I'm not sure.)
Any thoughts?
Yours sincerely,
Am 06.02.2010 um 17:43 schrieb Michael Howitz:
Hi,
I found something strange in metadata when copying a persistent object.
My situation is the following: I have a container with some elements inside. I create a copy of this container using
zope.copypastemove.ObjectCopier(my_container).copyTo(my_container.__parent__)
(Actually I use zope.copypastemove.interfaces.IObjectCopier(my_container) but this calls the adapter mentioned above.)
Side note: Is this the right way to copy an persistent object nowadays?
This happens tho dublin core metadata then: As zope.dublincore.timeannotators.CreatedAnnotator is subscribed to zope.lifecycleevent.IObjectCreatedEvent it gets called as the ObjectCopiedEvent is a subclass of ObjectCreatedEvent. The copy of the container gets a new creation date set in its metadata.
But zope.copypastemove.dispatchToSublocations calls the subscribers for the sublocations using zope.component.subscribers((sub, event), None)
So the zope.dublincore.timeannotators.CreatedAnnotator does not get called as it is not registered for (object, event) but only for (event,).
This leads to a strange situation: the metadata of the copied container get updated but not the metadata of its contents. This behavior has not changed since version 3.4.0 which was about 2,5 years ago.
I think this is a long-standing bug and it should it be fixed in zope.dublincore by registering the subscribers for (object, event)? (Additionally or exclusively, I'm not sure.)
Any thoughts?
As there were no replies I this bug into launchpad: https://bugs.launchpad.net/zope.copypastemove/+bug/620353
Yours sincerely,
Am 19.08.2010 um 11:56 schrieb Michael Howitz:
Am 06.02.2010 um 17:43 schrieb Michael Howitz:
Hi,
I found something strange in metadata when copying a persistent object.
My situation is the following: I have a container with some elements inside. I create a copy of this container using
zope.copypastemove.ObjectCopier(my_container).copyTo(my_container.__parent__)
(Actually I use zope.copypastemove.interfaces.IObjectCopier(my_container) but this calls the adapter mentioned above.)
Side note: Is this the right way to copy an persistent object nowadays?
This happens tho dublin core metadata then: As zope.dublincore.timeannotators.CreatedAnnotator is subscribed to zope.lifecycleevent.IObjectCreatedEvent it gets called as the ObjectCopiedEvent is a subclass of ObjectCreatedEvent. The copy of the container gets a new creation date set in its metadata.
But zope.copypastemove.dispatchToSublocations calls the subscribers for the sublocations using zope.component.subscribers((sub, event), None)
So the zope.dublincore.timeannotators.CreatedAnnotator does not get called as it is not registered for (object, event) but only for (event,).
This leads to a strange situation: the metadata of the copied container get updated but not the metadata of its contents. This behavior has not changed since version 3.4.0 which was about 2,5 years ago.
I think this is a long-standing bug and it should it be fixed in zope.dublincore by registering the subscribers for (object, event)? (Additionally or exclusively, I'm not sure.)
Any thoughts?
As there were no replies I this bug into launchpad: https://bugs.launchpad.net/zope.copypastemove/+bug/620353
I implemented a solution, see comment https://bugs.launchpad.net/zope.copypastemove/+bug/620353/comments/1
Could someone please review the solution before I merge it into trunk? Thanks in advance.
Yours sincerely,
Am 19.08.2010 um 15:43 schrieb Michael Howitz:
Am 19.08.2010 um 11:56 schrieb Michael Howitz:
Am 06.02.2010 um 17:43 schrieb Michael Howitz:
Hi,
I found something strange in metadata when copying a persistent object.
My situation is the following: I have a container with some elements inside. I create a copy of this container using
zope.copypastemove.ObjectCopier(my_container).copyTo(my_container.__parent__)
(Actually I use zope.copypastemove.interfaces.IObjectCopier(my_container) but this calls the adapter mentioned above.)
Side note: Is this the right way to copy an persistent object nowadays?
This happens tho dublin core metadata then: As zope.dublincore.timeannotators.CreatedAnnotator is subscribed to zope.lifecycleevent.IObjectCreatedEvent it gets called as the ObjectCopiedEvent is a subclass of ObjectCreatedEvent. The copy of the container gets a new creation date set in its metadata.
But zope.copypastemove.dispatchToSublocations calls the subscribers for the sublocations using zope.component.subscribers((sub, event), None)
So the zope.dublincore.timeannotators.CreatedAnnotator does not get called as it is not registered for (object, event) but only for (event,).
This leads to a strange situation: the metadata of the copied container get updated but not the metadata of its contents. This behavior has not changed since version 3.4.0 which was about 2,5 years ago.
I think this is a long-standing bug and it should it be fixed in zope.dublincore by registering the subscribers for (object, event)? (Additionally or exclusively, I'm not sure.)
Any thoughts?
As there were no replies I this bug into launchpad: https://bugs.launchpad.net/zope.copypastemove/+bug/620353
I implemented a solution, see comment https://bugs.launchpad.net/zope.copypastemove/+bug/620353/comments/1
Could someone please review the solution before I merge it into trunk? Thanks in advance.
As there were no comments, I merged the changes into trunk and released zope.dublincore 3.8.0 and zope.copypastemove 3.8.0 today.
Yours sincerely,