Hi, I have a working Pyhton script to search for users in a plone site with a commandline xmlrpc client. It cannot be changed into an external method because of the fact that it only works when running under a role with sufficient rights. So I turned it into a product. Basically I have (I have deleted some obvious code): class Xmlrpcindex(UniqueObject, SimpleItem): security = ClassSecurityInfo() security.declarePublic('search') def search (self, SearchableText): return 'foobar' The product is recignized as a Zope product and Plone product. It is installed in my Plone instance and I have made an instance in my Plone root (with id my_xmlrpc_instance). So the client looks like this: import xmlrpclib server = xmlrpclib.Server('http://localhost/plonesite/my_xmlrpc_instance') results = server.search('sometext') This however generates a NotFound Exception :-( Am I doing something elementary wrong? Should I call the search method in another way?
From the ZMI error log:
User Name (User Id) Anonymous User (None) Request URL http://localhost/plonesite/my_xmlrpc_instance/search Exception Type NotFound Exception Value http://localhost/plonesite/my_xmlrpc_instance/search Traceback (innermost last): * Module ZPublisher.Publish, line 92, in publish * Module ZPublisher.BaseRequest, line 344, in traverse * Module ZPublisher.HTTPResponse, line 640, in debugError -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________
On Tue, Apr 11, 2006 at 05:54:35PM +0200, Reinoud van Leeuwen wrote:
Hi,
I have a working Pyhton script to search for users in a plone site with a commandline xmlrpc client. It cannot be changed into an external method because of the fact that it only works when running under a role with sufficient rights. So I turned it into a product.
Basically I have (I have deleted some obvious code):
class Xmlrpcindex(UniqueObject, SimpleItem): security = ClassSecurityInfo() security.declarePublic('search')
def search (self, SearchableText): return 'foobar'
The product is recignized as a Zope product and Plone product. It is installed in my Plone instance and I have made an instance in my Plone root (with id my_xmlrpc_instance).
So the client looks like this:
import xmlrpclib server = xmlrpclib.Server('http://localhost/plonesite/my_xmlrpc_instance') results = server.search('sometext')
This however generates a NotFound Exception :-(
I'm not sure why you get NotFound, but one thing I spotted is that anything you want to publish in zope 2 must have a docstring. Stating the obvious: have you at least verified that the server url is correct? You should be able to point your browser directly at http://localhost/plonesite/my_xmlrpc_instance . also, I'm not familiar with xmlrpclib.Server. The library docs only mention xmlrpclib.ServerProxy, afaict. Presumably that's just a typo and you are using the standard xmlrpclib? -- Paul Winkler http://www.slinkp.com
Paul Winkler wrote:
On Tue, Apr 11, 2006 at 05:54:35PM +0200, Reinoud van Leeuwen wrote:
[...] This however generates a NotFound Exception :-(
I'm not sure why you get NotFound, but one thing I spotted is that anything you want to publish in zope 2 must have a docstring.
I've ran into situations where lack-of-docstring results in a NotFound. Not saying that this is the sole culprit of the trouble, but it's certainly worth knowing. -- Floyd May Senior Systems Analyst CTLN - CareerTech Learning Network fmay@okcareertech.org
On Tue, Apr 11, 2006 at 01:43:22PM -0500, Floyd May wrote:
Paul Winkler wrote:
On Tue, Apr 11, 2006 at 05:54:35PM +0200, Reinoud van Leeuwen wrote:
[...] This however generates a NotFound Exception :-(
I'm not sure why you get NotFound, but one thing I spotted is that anything you want to publish in zope 2 must have a docstring.
I've ran into situations where lack-of-docstring results in a NotFound. Not saying that this is the sole culprit of the trouble, but it's certainly worth knowing.
Thanks! that did it! Is this a bug or a feature? I would expect something else in the errorlog (or a warning in the eventlog) -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________
Reinoud van Leeuwen wrote:
On Tue, Apr 11, 2006 at 01:43:22PM -0500, Floyd May wrote:
Paul Winkler wrote:
On Tue, Apr 11, 2006 at 05:54:35PM +0200, Reinoud van Leeuwen wrote:
[...] This however generates a NotFound Exception :-(
I'm not sure why you get NotFound, but one thing I spotted is that anything you want to publish in zope 2 must have a docstring.
I've ran into situations where lack-of-docstring results in a NotFound. Not saying that this is the sole culprit of the trouble, but it's certainly worth knowing.
Thanks! that did it!
Is this a bug or a feature? I would expect something else in the errorlog (or a warning in the eventlog)
It's fundamental Zope security. Old as the hills. I'm sure it's in the Zope book. --jcc -- "Building Websites with Plone" http://plonebook.packtpub.com/ Enfold Systems, LLC http://www.enfoldsystems.com
On Tue, Apr 11, 2006 at 04:55:18PM -0500, J Cameron Cooper wrote:
I'm sure it's in the Zope book.
Doubt it, as the Zope book doesn't cover filesystem Product development. But it is in the ZDG :) http://www.zope.org/Documentation/Books/ZDG/current/ObjectPublishing.stx I do think it's odd he got NotFound, I haven't seen that. Maybe I'm just so used to running in debug mode that I've fixed all these before they ever got to a production server ;-) -- Paul Winkler http://www.slinkp.com
Paul Winkler wrote at 2006-4-11 20:06 -0400:
... I do think it's odd he got NotFound
One gets "NotFound" with "debug-mode off", one gets a message describing that a docstring is missing with "debug-mode on". It was an error to switch to "debug-mode off" by default... -- Dieter
Reinoud van Leeuwen wrote at 2006-4-11 17:54 +0200:
I have a working Pyhton script to search for users in a plone site with a commandline xmlrpc client. It cannot be changed into an external method because of the fact that it only works when running under a role with sufficient rights. So I turned it into a product.
Basically I have (I have deleted some obvious code):
class Xmlrpcindex(UniqueObject, SimpleItem): security = ClassSecurityInfo() security.declarePublic('search')
def search (self, SearchableText):
All published methods must have a non empty docstring. You search lacks a docstring. If you run Zope in development mode ("debug-mode on"), you will get a better error message.
... server = xmlrpclib.Server('http://localhost/plonesite/my_xmlrpc_instance') results = server.search('sometext')
This however generates a NotFound Exception :-(
Am I doing something elementary wrong? Should I call the search method in another way?
From the ZMI error log:
User Name (User Id) Anonymous User (None) Request URL http://localhost/plonesite/my_xmlrpc_instance/search Exception Type NotFound
-- Dieter
participants (5)
-
Dieter Maurer -
Floyd May -
J Cameron Cooper -
Paul Winkler -
Reinoud van Leeuwen