[mod_python] mod_python and ajax

Colin Bean ccbean at gmail.com
Tue Nov 25 13:18:13 EST 2008


2008/11/25 Cristian Re <cristian.re at gmail.com>:
> Hello, I would like to use mod_python to handle some ajax requests.
> I need that mod_python answers to ajax's requests only when some values on
> db changes.
> I thought to check db changes in a cycle while and wait a condition to
> return data.
> In this way each ajax request could take a long time before end and I don't
> know if mod_python can manage this and I don't know how many simultaneous
> requests can manage.
>
> Thanks
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>

I'd recommend writing an ajax function that polls your mod_python
handler every so often, and a server side function that checks the
value in the database and immediately returns whether it's changed or
not.  This pattern has worked well for me; I don't know how mod_python
(or the client) would handle lots of requests that are expected to
stay open for a while.

Colin


More information about the Mod_python mailing list