[Product-Developers] Crash while moving folder contents
Maarten Nieber
maarten at usecm.com
Fri Dec 2 16:37:08 UTC 2011
Hi,
I need to replace a document that has content type Section with another
document that has content type SectionMarketing. My approach is to simply move
the folder contents from the old instance to the new instance, using these
lines:
ids = [item.id for item in section.listFolderContents()]
section.manage_cutObjects(ids)
marketingsection.manage_pasteObjects()
and then replace the old instance with the new instance in my tree structure.
The call to manage_pasteObjects triggers an error: "No clipboard data found."
(packed inside an HTML formatted error message).
Can somebody point out what I'm doing wrong?
Thanks!
Maarten
ps My entire upgrade function is
def upgrade_16_to_17b(setup):
catalog = getToolByName(setup, 'portal_catalog')
brains = catalog(object_provides=IMarketingContainer.__identifier__)
for brain in brains:
container = brain.getObject()
sections = container.listFolderContents()
for section in sections:
id = section.id + '_marketing'
container.invokeFactory('abb.types.sectionmarketing', id,
title=section.title + '_marketing')
marketingsection = container[id]
ids = [item.id for item in section.listFolderContents()]
section.manage_cutObjects(ids)
marketingsection.manage_pasteObjects()
container.manage_delObjects(section.id)
More information about the Product-Developers
mailing list