Michael Goettsche wrote:
> On Monday 06 February 2006 21:41, Blake Winton wrote:
>>> The processing of a form will take
approximately 10 seconds.
>>> I don't want the user to see what's going on
and don't want him to have
>>> to wait until processing is done.
>>> So, I wonder how I can solve my problem as
CherryPy shows the return
>>> value of the method to the user and no further
processing is possible
>>> after 'return'ing a method.
>> You could use yield...
>>
>> See http://bwinton.latte.ca/Programming/cherry
Py/UpdateComics/ComicsApp.py
>> for a small example.
>>
>> Later,
>> Blake.
>
> Interesting idea, thanks. So I could simply write:
> def index(self):
> yield "Thanks for filling out the form
blablablablabla"
> doRessourceIntensiveJob()
>
> and the user would see the message immediately without
knowing that there is
> further setup going on? Are there any possible side
effects in using this
> approach?
Well, I think you have to explicitly turn on the following
config options:
"server.protocolVersion":
"HTTP/1.1"
"streamResponse": True
Otherwise, the entire body of the page handler is consumed
and then sent
in the response.
I think there are some issues with CP only being
"conditionally"
HTTP/1.1 compliant. AFAIK, these problems are mitigated if
you run
behind Apache and use it for serving static content.
What was your experience with it Blake?
Christian
|