[Zope-CMF] search via xmlrpc

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 12 Aug 2002 09:13:02 -0700


Forgive me if I misunderstand the problem.  Though I have been looking in=
to
doing this myself, I haven't done this (so forgive my ignorance), but I
think it is highly likely that you may need to create some custom scripts=
 to
do this.  Part of the problem, I think, would be that it is highly unlike=
ly
that lists of "brains" (ZCatalog brain objects) are something that can be
automatically marshaled over XML-RPC (someone correct me if I am wrong), =
nor
are your content objects.  What you may want to do is create a python scr=
ipt
that returns a list of tuples containing the relevant metadata from the
brain/result object, and perhaps data from the result of a getObject() ca=
ll
(especially, the identifier of the object including a full path - or bett=
er
yet, a URL for the object to act as an XML-RPC entry point).

You may want to create a skin just with methods for XML-RPC clients, and =
use
a access rule script to guarantee that an XML-RPC client would use this s=
kin
(has anyone tried this???).  Also, assuming that your XML-RPC client coul=
d
do some sort of HTTP basic auth, I assume your catalog queries would act
like they would in any other CMF skin (based upon your user/role).

#Perhaps a script like this is a start, would return identifiers for obje=
ct:
#ASSUME THAT THIS SCRIPT ACCEPTS A STRING PARAMETER CALLED subject
cat =3D context.portal_catalog
brains =3D cat.searchResults(subject=3D{'query':subject})
identifiers =3D []
for brain in brains:
    #let's assume the info you want is in the object itself, not in metad=
ata
tables
    o =3D brain.getObject()
    identifiers.append(o.Identifier())
return identifiers


In theory, this makes sense (I think), since basic sequence data types
should be able to be easily marshaled over XML-RPC.  I'm still not sure h=
ow
exceptions would be handled by Zope (since I'm guessing that they might
return HTML), but it is highly unlikely that you would end up running int=
o
exceptions if you wrote your own search functions to do this (the worst y=
ou
could get is an empty sequence).

Does this make sense?  Since I'm not very experienced with XML-RPC, I hop=
e
this is the right path; anyone on the list with more experience with this
sort of thing who wants to add corrections and/or clarifications to this
should feel free to do so.

Sean

-----Original Message-----
From: Sylvain Th=E9nault [mailto:Sylvain.Thenault@logilab.fr]
Sent: Monday, August 12, 2002 7:20 AM
To: Zope-Cmf Mailing list
Subject: [Zope-CMF] search via xmlrpc


hello,

I would like to use the cmf search facilities using xmlrpc. I encounter
two problems when I try to call the "search" method :
_ it only works without any arguments
_ the results are returned in an html page

I guess I'm missing something somewhere... Any idea or pointer ?
TIA

--=20
Sylvain Th=E9nault

  LOGILAB           http://www.logilab.org


_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests