I've run into precisely the same thing using JSON-RPC, and I did
create a method to list all the other methods. However, I discovered
through use that this was not nearly as simple as I thought. Because a
single object can have multiple classes of JSON/XML methods, each one
with their own or multiple view directives, and each view directive
must specify the available methods, if each of those directives
specifies a methodList method, then when you call it, you will likely
get a list for a different class of methods than you were expecting.
I'm sure there is some better way to implement it, but it seems it
would require either some very messy coding, or some significant
changes to the structure of Zope. Because it does not instantiate the
view until after the method is requested, and it selects the view
based on the requested method, it seems a generic methodList() is
unlikely to be effective (unless you choose to keep all your methods
for an object in a single view, which certainly would work in many
cases, but was a pain for ours). Another possibility, it seems, would
be to have a generic method that, in addition to introspecting the
view it was called from, examined all the other views that might be
applicable, and returned their methods.

Any ideas for how to get around these limitations? I can't claim to be
any sort of expert, so if I'm making false assumptions, or just plain
wrong, please correct me.

Take care,

Alec Munro

On 9/30/05, Tarek Ziadé <[EMAIL PROTECTED]> wrote:
> Hi all,
> I was wondering if there's actually any way to make xmlrpc introspection
> in Z3,
> so i can list methods from my rpc client.
> (it seems not, looking at the code and the agile doc there
> http://svn.zope.org/Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt?rev=38357&view=markup)
> --------------
> If not, i've found this proposal on the web:
> http://xmlrpc-c.sourceforge.net/xmlrpc-howto/xmlrpc-howto-api-introspection.html
> I've thaught of wrapping my xmlrpc views with an adapter to provide  the
> 3 extra methods in the view class:
> class IXMLRPCIntrospector(View):
>     """IXMLRPCIntrospector View"""
>     [...] some constructor [...]
>     def listMethods():
>         """ lists all xmlrpc methods implemented by the underlying view """
>     def methodHelp(method_name):
>         """ returns the docstring of given method """
>     def methodSignature(method_name):
>         """ returns the signature of given method
>         ie the list of all arguments
>         """
> Any advice ?
> imo xmlrpc introspection can be useful in some cases
> (in my case i need such feature to actually let the client application
>  remote-control the site)
> Would it be interesting to start a Z3 proposal on this topic ?
> Best regards,
> Tarek
> --
> Tarek Ziadé, Nuxeo R&D (Paris, France)
> CPS Platform : http://www.cps-project.org
> Zope3 / ECM   : http://www.z3lab.org
> mail: tziade at nuxeo.com; tel: +33 (0) 6 30 37 02 63
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev@zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/alecmunro%40gmail.com
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to