[Zope] Copying objects in ZODB programmatically

Dieter Maurer dieter@handshake.de
Fri, 12 Apr 2002 22:06:30 +0200


Noel Duffy writes:
 > I am trying to make a copy of an object in my ZODB using
 > manage_copyObjects and manage_pasteObjects. I have code
 > like this:
 > 
 >     import Zope
 >     app=Zope.app()
 >     x=app.manage_copyObjects([app['getad'].id])
 >     app.manage_pasteObjects(x)
"manage_pasteObjects" (more precisely, "_verifyObjectPaste"
performs its own security check, even if called in an
unrestricted environment.

  As in your context, there is not user, the check fails.

I see two options:

  *  modify Zope's code (e.g. by adding a new "manage_pasteObjects_woCheck"
     without this check)

  *  create a request object with authentication information,
     perform a "traverse" on this object (this will set the 
     user) and then call "manage_pasteObjects" on the traverse to
     object.


Dieter