either XMLRPC or the functional testing ServerProxy seems to have a
slight regression. The zope.app.publisher.xmlrpc tests which use the
functional testing ServerProxy don't fail.

I've attached a doctest that demonstrates the failure on the trunk. (404
- Doesn't find the XMLRPC view.)

The same code to register an XMLRPC view is used within the grok project
and it works when firing up the server and attaching Python's

The same effect happens over here with an XMLRPC view that is registered
using ZCML: works in 'real life' but not with the tests.

I couldn't find any change in the last days that would trigger this, and
the xmlrpc tests are fine, so I'm a bit puzzled here.


gocept gmbh & co. kg - forsterstra├če 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development

XMLRPC ServerProxy for functional tests

The XMLRPC ServerProxy allows to test XMLRPC views within functional tests by
modifying the behaviour of Python's built-in xmlrpclib's ServerProxy to
support the special publication mechanism (HTTPCaller) that Zope uses in its
functional tests.

Let's register an XMLRPC view:

  >>> class XMLRPCView(object):
  ...     def __init__(self, context, request):
  ...         self.context = context
  ...         self.request = request
  ...     def name(self):
  ...         return self.context.__name__
  >>> method_view = type(
  ...     XMLRPCView.__name__, (XMLRPCView, MethodPublisher),
  ...     {'__call__', XMLRPCView.name})
  >>> import zope.component
  >>> zope.component.provideAdapter(
  ...     XMLRPCView.name, (Interface, IXMLRPCRequest), Interface, name='name')

Now, let's create a server proxy and ask the root object for its name (it
doesn't have one):

  >>> from zope.app.testing.xmlrpc import ServerProxy
  >>> server = ServerProxy("http://localhost/";, handleErrors=False)
  >>> server.name()

Attachment: signature.asc
Description: OpenPGP digital signature

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to