I've run into a few problems using generators in my controller methods to return data. I've created a test controller below that demonstrates two things I've found so far.
The first is that using abort() from a generator method doesn't seem to be caught properly by pylons (or maybe paste) so instead of the client getting a 404 error, he sees a "Server Error" page (HTTP status 200). The second issue is that the globals object seems to go away between the time when the generator stops yielding data and when the finally clause is executed. This only seems to happen when debug=false in the .ini file. Both of these problems are exhibited on a default pylons 0.9.6 project (on my machine at least). Cheers, Chris import time from testproj.lib.base import * class TestiterController(BaseController): def test1(self): abort(404) yield "Hello World" def test2(self): try: print "G is", g g.foo = "bar" for i in range(50): time.sleep(0.1) yield "%s<br/>\n" % i finally: print "G is", g print g.foo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---