[Zope3-Users] getting post data in a Zope 3 view

Chris Withers chris at simplistix.co.uk
Tue Aug 19 07:14:16 EDT 2008


Hi All,

I have a view:

from zope.publisher.browser import BrowserView

class Receiver(BrowserView):

     def __call__(self):
         print self.request.bodyStream.read()
         return 'done'

...which I'm trying to test with the following script:

import socket
socket.setdefaulttimeout(5)
from httplib import HTTPConnection
c = HTTPConnection('localhost:8080')
c.request('POST','/@@wasp','foo',{'Content-type':'text/plain',
                                   'Content-length':3})
print c.getresponse().read()

...but the processing seems to hang in bodyStream.read() until the 
socket times out on the client side (ie: I get a timeout exception)
at which point the read() returns and shows what I'd expect.

What am I doing wrong?

cheers,

Chris


-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope3-users mailing list