Istvan Albert wrote:
> I can't seem to be able to get it to work. I read the:
>
> http://www
.cherrypy.org/wiki/ReturnVsYield
>
> But that does not work, the returns are always
flattened. I would ask
> the CP people to provide a simple example that actually
does
> what it is
> supposed to. Below I'm providing a minimalistic
application below that
> does not work properly yet based on the docs it should.
The desired
> outcome is to have the words: Hello World! appear at
about 1 seconds
> apart. Instead the list is flattened and all three
appear after 3
> seconds. (url: localhost:8080/thing)
>
>
> import cherrypy
> import time
> settings = {
> 'global': {
> 'server.protocolVersion':
"HTTP/1.1",
> 'server.threadPool': 10,
> },
> }
> cherrypy.config.update(settings)
> cherrypy.config.update({'/thing': {'streamResponse':
True}})
>
> class Root:
> cherrypy.expose
> def thing(self):
> for word in ('Hello ', 'world ', '!'):
> yield word
> time.sleep(1)
>
> cherrypy.root= Root()
> cherrypy.server.start()
I think the default is still for an app to be in
"development" mode,
which means logdebuginfofilter will be on, which will
flatten the
output. Try setting "server.environment" to
"production" in your config.
Robert Brewer
System Architect
Amor Ministries
fumanchu amor.org
|