[Web-SIG] WSGI and asyncronous applications support
exarkun at divmod.com
Tue Sep 18 14:40:57 CEST 2007
On Tue, 18 Sep 2007 13:39:23 +0200, Manlio Perillo <manlio_perillo at libero.it> wrote:
>1) should be very simple to implement, and it is easy to understand how
>to use it.
>As an example, we can use some API that calls a callback function when
>the result is available:
>conn.execute("SELECT * FROM test", query_callback)
>2) Can be implemented in mod_wsgi, however my problem is that I can't
>figure out how the application can yield some data available after a
>callback is called.
I think you figured it out already, actually:
conn.execute("SELECT * FROM test", query_callback)
# indicate not-done-yet, however
conn.execute("SELECT * FROM test2", another_callback)
If you can have one callback, then there's no reason you shouldn't be
able to have an arbitrary number of callbacks.
Of course, this could also be expressed in a less error prone manner:
test_deferred = conn.execute("SELECT * FROM test")
test2_deferred = conn.execute("SELECT * FROM test2")
More information about the Web-SIG