[Zope] cut/paste and change id

Max M maxm@mxm.dk
Wed, 18 Jun 2003 00:57:14 +0200


Ruslan Spivak wrote:
> Hello, zope users!
> 
> Can anybody give an advice how to implement the following:
> i need cut some objects from folder, change their id and paste into 
> another folder, programmatically.
> 
> I know for cuting/pasting - manage_cutObjects/manage_pasteObjects, but 
> how to change ids in cut objects but not yet pasted?

It sounds fishy. I would move the objects one at a time, and rename them 
  in the process.

objects = from_folder.objectValues()
from_folder.manage_delObjects(from_folder.objectIds())
for obj in objects:
     obj.id = new_id
to_folder._setObject(new_id, obj)


regards Max M