[Zope-CMF] Python: trying to copy files

Ryan P. de Vega rpd4972@hbu.edu
Thu, 25 Jul 2002 14:23:10 -0500


Here is what I have so far - I have stripped it down to debug.  This works
as far as putting the selected objects into the CMF root.  When I try to
add the "TEST" part into line 4 as suggested, I get an error in the portal
when I try to execute - The object testobject does not support this
operation .   Ideas?

Ryan

REQUEST=context.REQUEST
if REQUEST.has_key('ids'):
  tmpObj = context.manage_copyObjects(REQUEST['ids'])
  context.portal_url.getPortalObject().manage_pasteObjects(tmpObj)
  return REQUEST.RESPONSE.redirect(context.absolute_url() +
'/folder_contents?portal_status_message=Item(s)+Published.')
else:
  return REQUEST.RESPONSE()


schubbe@web.de writes:
>Ryan P. de Vega wrote:
>> Is 'targetfolder' something I would need to define?  If so, I think this
>> is where I have been having my problem all along.  What do I define as
>the
>> targetfolder if for example I want to paste the objects into a folder in
>> the ZMI called /CMF/TEST ?  This helps, but I'm not quite there yet?
>> 
>> Thanks!
>> Ryan
>> 
>> schubbe@web.de writes:
>> 
>>>Did you try this?
>>>
>>>tmpObj = context.manage_copyObjects(REQUEST['ids'])
>>>context.portal_url.getPortalObject().targetfolder.manage_pasteObjects(tmpObj)
>
>CMF seems to be your site root, you get it using 
>context.portal_url.getPortalObject()
>
>TEST is your target folder
>
>This should work for you:
>context.portal_url.getPortalObject().TEST.manage_pasteObjects(tmpObj)
>
>Yuppie