Can't get "objectIds()" (and others) from XML-RPC
Hi group... I'm trying to use XML-RPC server features of ZOPE using Fredrik Lundh's xmlrpclib and the BasicAuthTransport class explained in Amos Latteier's Howto http://www.zope.org/Members/Amos/XML-RPC. I've tried to do some stuffs explained in Amos's article at http://www.xml.com/lpt/a/2000/01/xmlrpc/index.html I succeeded reading a DTML document with server.document_src() but when trying to get a folder objects list, like in the example: <python> from xmlrpclib import Server from BasicAuthTransport import BasicAuthTransport srv = xmlrpclib.Server('http://localhost:8080/anyfolder', BasicAuthTransport('myself', 'mypassword')) print srv.objectIds() # raises the xmlrpclib.Fault exception </python> I got always this exception ! <console> Traceback (most recent call last): File "./userlist.py", line 10, in ? print srv.objectIds() File "/usr/lib/python2.1/site-packages/xmlrpclib.py", line 539, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.1/site-packages/xmlrpclib.py", line 622, in __request request File "./BasicAuthTransport.py", line 46, in request return self.parse_response(h.getfile()) File "/usr/lib/python2.1/site-packages/xmlrpclib.py", line 593, in parse_respo nse return u.close() File "/usr/lib/python2.1/site-packages/xmlrpclib.py", line 367, in close raise apply(Fault, (), self._stack[0]) xmlrpclib.Fault: <Fault -2: 'Unexpected Zope error value: <html><head><title>D ... </TD>\n\n<TD WIDTH="90%">\n <H2>Site Error</H2>\n <P>An error was encountered while publishing this resource. </P>\n <P><STRONG>Resource not found</STRONG></P> Sorry, the requested resource does not exist.<p>Check the URL and try again.<p> <!-- http://localhost:8080/anyfolder/objectIds --> <HR NOSHADE> <P>Troubleshooting Suggestions</P>\n\n <UL>\n <LI>T he URL may be incorrect.</LI>\n <LI>The parameters passed to this resource may </console> "objectIds" method is not the only one that raises an exception. When using methods inherited from class "ObjectManagerItem", it works but I got similar exception when using other methods inherited from class "ObjectManager". As mentioned in the API doc, a folder is supposed to be a subclass of "ObjectManagerItem" and "ObjectManager". Did I miss something ? Thanks in advance for any hint.
I have added a manage tab to a product and no matter what type of reboot, refresh, re-whatever I do I cannot seem to get the manage tab to show up. {'label': 'Advanced', 'action': 'manage_catalogAdvanced', 'target':'manage_main'}, Even if I change a name of one of the existing managed tabs, it does not show up? Anyone have any ideas? Thanks, JMA
----- Original Message ----- From: "Gilles Lenfant" <glenfant@bigfoot.com> To: <zope@zope.org> Sent: Friday, May 11, 2001 11:12 AM Subject: [Zope] Can't get "objectIds()" (and others) from XML-RPC <snip>
"objectIds" method is not the only one that raises an exception. When using methods inherited from class "ObjectManagerItem", it works but I got similar exception when using other methods inherited from class "ObjectManager". As mentioned in the API doc, a folder is supposed to be a subclass of "ObjectManagerItem" and "ObjectManager".
Did I miss something ?
Yes, you did! The objectIds are no longer callable via a URL, they can only be called from DTML or Python (internal and external). This means that you can't call it via XML-RPC. Don't lose hope though, here's how to get around this limitation. Create an Internal Python Script in the root of Zope, with these contents: return context.objectItems() This will return the list and all will be well. You should though have some security on this method, otherwise *everybody* will see the contents on your Zope instance.
Thanks in advance for any hint.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
BZ -
Gilles Lenfant -
Phil Harris