[Zope3-checkins]
SVN: Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/
listAllMethod initial implementation
Tarek Ziadé
tziade at nuxeo.com
Sat Oct 8 12:04:34 EDT 2005
Log message for revision 38962:
listAllMethod initial implementation
Changed:
U Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/README.txt
U Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/configure.zcml
U Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py
-=-
Modified: Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/README.txt
===================================================================
--- Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/README.txt 2005-10-08 15:47:03 UTC (rev 38961)
+++ Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/README.txt 2005-10-08 16:04:34 UTC (rev 38962)
@@ -116,8 +116,9 @@
... <include package="zope.app.publisher.xmlrpc" file="meta.zcml" />
... <xmlrpc:view
... for="zope.interface.Interface"
- ... methods="listAllMethods methodHelp methodSignature"
+ ... methods="listAllMethods methodHelp methodSignature"
... class="zope.app.xmlrpcintrospection.xmlrpcintrospection.XMLRPCIntrospection"
+ ... permission="zope.Public"
... />
... </configure>
... """)
@@ -125,12 +126,10 @@
They are linked to XMLRPCIntrospection class, that actually
knows how to lookup to all interfaces
-And call our xmlrpc method:
+And call our xmlrpc method, that should list the content method:
>>> print http(r"""
... POST / HTTP/1.0
- ... Authorization: Basic bWdyOm1ncnB3
- ... Content-Length: 102
... Content-Type: text/xml
...
... <?xml version='1.0'?>
@@ -139,7 +138,24 @@
... <params>
... </params>
... </methodCall>
- ... """)
- 'in process'
+ ... """, handle_errors=False)
+ HTTP/1.0 200 Ok
+ Content-Length: ...
+ Content-Type: text/xml...
+ <BLANKLINE>
+ <?xml version='1.0'?>
+ <methodResponse>
+ <params>
+ <param>
+ <value><array><data>
+ <value><string>contents</string></value>
+ </data></array></value>
+ </param>
+ </params>
+ </methodResponse>
+ <BLANKLINE>
+
+
+
Modified: Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/configure.zcml
===================================================================
--- Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/configure.zcml 2005-10-08 15:47:03 UTC (rev 38961)
+++ Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/configure.zcml 2005-10-08 16:04:34 UTC (rev 38962)
@@ -4,9 +4,10 @@
i18n_domain="zope">
<xmlrpc:view
- for="zope.interface.interfaces.IInterface"
+ for="zope.interface.Interface"
methods="listAllMethods methodHelp methodSignature"
class="zope.app.xmlrpcintrospection.xmlrpcintrospection.XMLRPCIntrospection"
+ permission="zope.Public"
/>
</configure>
Modified: Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py
===================================================================
--- Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py 2005-10-08 15:47:03 UTC (rev 38961)
+++ Zope3/branches/tziade_xmlintrospection/src/zope/app/xmlrpcintrospection/xmlrpcintrospection.py 2005-10-08 16:04:34 UTC (rev 38962)
@@ -20,25 +20,36 @@
from zope.interface import providedBy
from zope.publisher.interfaces.xmlrpc import IXMLRPCRequest
from zope.app.publisher.xmlrpc import XMLRPCView
-from zope.app.apidoc.presentation import getViews, filterViewRegistrations,\
- SPECIFIC_INTERFACE_LEVEL
+from zope.app.apidoc.presentation import getViews, filterViewRegistrations
-class XMLRPCIntrospection(XMLRPCView):
+class XMLRPCIntrospection(object):
- def _getXMLRPCViews(self):
+ _reserved_method_names = (u'', u'listAllMethods', u'methodHelp',
+ u'methodSignature')
+
+ def _filterXMLRPCRequestRegistrations(self, registrations):
+ for registration in registrations:
+ for required_iface in registration.required:
+ if (required_iface is IXMLRPCRequest and
+ registration.name.strip() not in
+ self._reserved_method_names):
+ yield registration.name
+
+ def _getXMLRPCMethods(self):
adapter_registrations = []
interfaces = list(providedBy(self.context))
for interface in interfaces:
- registrations = list(getView(interface, IXMLRPCRequest))
- results = filterViewRegistrations(registrations,IXMLRPCRequest,
- level=SPECIFIC_INTERFACE_LEVEL)
- adapter_registrations.append(list(results))
+ registrations = list(getViews(interface, IXMLRPCRequest))
+ results = list(self._filterXMLRPCRequestRegistrations(registrations))
+ for result in results:
+ if result not in adapter_registrations:
+ adapter_registrations.append(result)
return adapter_registrations
def listAllMethods(self):
- return []
+ return self._getXMLRPCMethods()
def methodHelp(self, method_name):
pass
@@ -46,3 +57,6 @@
def methodSignature(self, method_name):
pass
+ def __call__(self, *args, **kw):
+ return self.listAllMethods()
+
More information about the Zope3-Checkins
mailing list