yield environ['x-wsgiorg.fdevent.readable'](fd) yield t.write(os.read(fd, 4096)) os.close(fd) except GeneratorExit: pass os.unlink(fname) return iterator() # from http://code.google.com/p/modwsgi/wiki/IntegrationWithWebPy try: # webpy 0.3 application = web.application(urls, globals()).wsgifunc() except AttributeError: # webpy 0.2 application = web.wsgifunc(web.webpyfunc(urls, globals())) def simplest_application(environ, start_response): t = transports.get_transport('xhrstream') start_response('200 OK', t.get_headers()) def iterator(): yield t.start() yield t.write('fist message!') yield t.write('second message!') yield t.write('third message!') return iterator()
# ------------------------------------------------------------------- #