[Zope] Re: Problem with xmlrpc and manage_pasteObjects
Juan Carlos Coruņa
jcoruna@euskalnet.net
Sat, 21 Apr 2001 00:14:12 +0200
Here I have some answers for somebody interested:
Casey Duncan wrote:
>AFAIK, copy and paste in Zope use Cookies, so they won't work over
>XML-RPC as you found. You could move something programatically as
>follows
>obj = context.tmp[id].aq_base
>context._setObject(obj, id)
>context.tmp.manage_delObjects(id)
>This code could not be called directly from XML-RPC however...
>Probably your best bet is to create a moveObject() external method that
>does the above and call it from XML-RPC.
First, I don't call manage_pasteObjects directly using xmlrpc, I call a
python script that uses manage_pasteObjects and since it works when I
execute this script manually and cookies (clicking the test tab) and
cookies disabled in the browser I suppose it must work when I call the
python script using xmlrpc. What is the diference?
(With the cookies disabled the paste button doesn't appears in the Zope
management interface, then its correct that the cut/paste doesn't works
without cookies using the management interface.)
Second, there is a little mistake in the second line in your example
(see my example). Here is the external method I use, following your
instructions (thanks):
def moveObject(self, origin, destination, id):
if origin: obj = self[origin][id].aq_base
else: obj = self[id].aq_base
if destination: self[destination]._setObject(id, obj)
else: self._setObject(id, obj)
if origin: self[origin].manage_delObjects(id)
else: self.manage_delObjects(id)
I call this method from inside a script that is called by xmlrpc.
Nevertheless, thank you Casey for your help.
-----
Phil Harris wrote:
>I'm pretty sure that the cut/copy/paste functionality needs cookies to
do
>the work.
>
>xmlrpc doesn't as yet support cookie, so there is a problem there.
>
>Hope that helps.
Yes, true, cut/copy/paste needs cookies, but only if you use the
management interface to accomplish the paste. If you do the paste
programatically the variable in front of the manage_cutObjects command
acts like the cookie, storing the reference to the cutted object.
And, since I use xmlrpc to invoke a script that includes the necessary
code to cut'n'paste I don't need cookie support.
To solve the problem I finally use the method suggested by Casey Duncan.
-------
Chris McDonough wrote:
>This works from the management interface?
Yes, it works. If you execute the script clicking on the test tab it
works. ;-)
I found this in http://groups.yahoo.com/group/zope/message/54267
suggested by Wolfgang Strobl.
-------
After, all this I hope that this message will be helpful for other
people.