[Zope] Copying objects in ZODB programmatically

Noel Duffy noel@propylon.com
Sat, 13 Apr 2002 15:41:31 +0100


On Friday 12 April 2002 21:06, Dieter Maurer wrote:
> 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.
>

Thanks for the quick reply.

Do you have an example of how one would do this, as I cannot quite
picture in my head how this should be approached?

Thanks again,

Noel.