[Zope] Is there an easier (more stylish, ...) way

Florent Guillaume fg@nuxeo.com
Sat, 6 Jul 2002 08:14:54 +0000 (UTC)


Cameron Laird  <Cameron@Lairds.com> wrote:
> Is there an easier (more stylish, ...) way
> to (deep-)copy an object in a Python script than a
>   manage_clone
>   manage_cutObjects
>   manage_pasteObjects
> sequence?  What I really want is
>   def this_copy(from_folder, to_folder, object_id)
>   '''We start with an object with id object_id in folder
>   from_folder.  After invocation of this function, a copy,
>   with identical properties and children, exists in to_folder.'''

manage_clone does basically that (with a different syntax) but you'll
have to call it from an external method:
  ob = from_folder[object_id]
  newid = object_id
  to_folder.manage_clone(ob, newid)

Note that your external method will have to do its security checks
too.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com