[Zope3-Users] feedback while asking response

Florent Guillaume fg at nuxeo.com
Thu Apr 14 08:43:54 EDT 2005


Stephan Richter  <srichter at cosmos.phy.tufts.edu> wrote:
> You can do this by directly writing to the response and not returning anything 
> through the executing method:
> 
> class View(object):
> 
>   def __call__(self):
>     response = self.request.response
>     # ... set all necessary headers
>     response.write(data)
>    sleep(10)
>     response.write(data)
>    sleep(10)
>    response.write(data)

Note that, when you do that (and it is also true for Zope 2), you start
sending data directly to the browser before the end of the transaction,
so if later on a ConflictError then occurs and the request has to be
retried from scratch, the user will already have received data on its
socket. I'm not even sure what the zserver code is able to do (send
further data after the one from the aborted transaction ? fail ?).

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope3-users mailing list