maintaining last_modified_date when copying an object
Hi, I've written a short Script (Python) to copy objects from an existing Folder to a new BTree Folder. If possible, I'd like to maintain the original last_modified date of the copied objects - is there a simple way of doing this ? Script is as below... Thanks! PETER SKIPWORTH SYSTEM ADMINISTRATOR TOUCHCORP LTD TELEPHONE 03 9635 2626 www.touchcorp.com dest_base = context.restrictedTraverse('/Contacts_BTree') src_base = context.restrictedTraverse('/Contacts') cont_list = src_base.objectItems() # where the objects to copy live for src_id, src_obj in cont_list: print src_id copy_info = src_base.manage_copyObjects((src_id)) dest_base.manage_pasteObjects(copy_info)
if by last modified dat you mean "bobobase_modification_time" then no, there is no way. that value is generated by the underlying ZODB code and cannot be set. if you have products where you want to store a modification date it is recommended that you set your own attribute and manipulate that attribute instead of relying on bobobase_modification_time, over which you have no control. jens On Tuesday, Dec 17, 2002, at 01:32 US/Eastern, pskipworth@touchcorp.com wrote:
Hi,
I've written a short Script (Python) to copy objects from an existing Folder to a new BTree Folder. If possible, I'd like to maintain the original last_modified date of the copied objects - is there a simple way of doing this ?
On Tue, Dec 17, 2002 at 08:06:45AM -0500, Jens Vagelpohl wrote:
if by last modified dat you mean "bobobase_modification_time" then no, there is no way. that value is generated by the underlying ZODB code and cannot be set.
if you have products where you want to store a modification date it is recommended that you set your own attribute and manipulate that attribute instead of relying on bobobase_modification_time, over which you have no control.
Note that this has been addressed in zope 3, so when zope 3 is useable you won't need to roll your own anymore. :) -- Paul Winkler http://www.slinkp.com "Welcome to Muppet Labs, where the future is made - today!"
participants (3)
-
Jens Vagelpohl -
Paul Winkler -
pskipworthï¼ touchcorp.com