[Zope-dev] XML-RPC does not work under the paster process

Christian Theune ct at gocept.com
Tue May 26 02:22:30 EDT 2009


On Mon, 2009-05-25 at 17:08 +0200, Michael Haubenwallner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Christian Theune wrote:
> > [...]
> > 
> > Nevertheless: passing in 0 seems to be the safe bet in general and I
> > wonder what is actually breaking. I haven't seen a traceback be attached
> > at either bug. Also, those bugs should probably be marked as duplicates.
> > 
> 
> You are right, looking at the problem again i suggest to add this change
> to zope.publisher.xmlrpc

Uhhhm. Why are we changing this? IMHO passing 0 should work and I don't
see what the actual breakage is.

> - --- src/zope/publisher/xmlrpc.py	(revision 100356)
> +++ src/zope/publisher/xmlrpc.py	(working copy)
> @@ -46,10 +46,14 @@
>          'See IPublisherRequest'
>          # Parse the request XML structure
> 
> - -        # XXX using readlines() instead of lines()
> - -        # as twisted's BufferedStream sends back
> - -        # an empty stream here for read() (bug)
> - -        lines = ''.join(self._body_instream.readlines())
> +        # XXX using readline() instead of readlines()
> +        # as readlines() is not working with
> +        # paster.httpserver
> +        line = 1
> +        lines = ''
> +        while line != '':
> +            line = self._body_instream.readline()
> +            lines += line
>          self._args, function = xmlrpclib.loads(lines)

I'm fine with the patch. I just don't understand why we need it. :/

Here's a small readability suggestion:

lines = ''
while True:
    line = self._body_instream.readline()
    if not line:
        break
    lines += line

I think assigning assigning an unused value can lead to confusions and
the head-controlled loop obfuscates whats actually going on.

Cheers,
Christian

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 7 · fax +49 345 1229889 1
Zope and Plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20090526/48ec0fd4/attachment.bin 


More information about the Zope-Dev mailing list