In Pylons 1.0 I've had the opposite issue. If debug is turned on I can have
a controller yield streaming content directly, but if debug is turned off it
raises an exception. However, it should work as long as you wrap the
generator function inside the controller function, like in the linked
example. For instance, if you wanted to stream textual data in some form
based on a query:
def controllerfunction(self):
response.content_type = <appropriate content type for the header>
def streamdata():
for q in queryobject:
yield '%s: %s\n' % (q.field1, q.field2)
return streamdata()
This works for me with and without debug. Is it not working for you in
Pylons 1.0?
-Eric
On Sun, Jan 2, 2011 at 4:19 PM, nh2 <[email protected]> wrote:
> The FAQ "Streaming Content to the Browser" (http://docs.pythonweb.org/
> display/pylonsfaq/Streaming+Content+to+the+Browser<http://docs.pythonweb.org/%0Adisplay/pylonsfaq/Streaming+Content+to+the+Browser>)
> says:
>
> "First, turn off debug mode in your ini file [...] When debug mode is
> on, streaming can't occur because the exception middleware needs to
> have the entire response finished first."
>
> Is there a way to disable debug (buffering) for just that controller
> that shall stream data? I don't want to lose all the debugging help
> only because one controller is streaming.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<pylons-discuss%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.