[Twisted-Python] Re: Re: rewrite of flow.py completed
Clark C. Evans
cce at clarkevans.com
Tue Apr 15 15:11:37 EDT 2003
On Tue, Apr 15, 2003 at 10:44:04AM +0200, Philippe Lafoucrière wrote:
| sorry, this was a connexion problem.
It should have raised an exception if it couldn't connect. I think
the new flow.py (you seemed to have been using an older one) should
fix this, but perhaps not, as I haven't tested it.
| NTL, I can't use QueryIterator with a consumer.
Hmm. The following should work...
dbpool = adbapi.ConnectionPool("MySQLdb",
sql = """SELECT nom FROM dbo_questionnaire limit 0,50"""
query = flow.Generator(QueryIterator(dbpool, sql))
if query.stop: break
Or, if you want to use the twisted reactor to allow for
more than one process...
from twisted.internet import reactor
def res(x): print "Results : ", x
f = flow.DeferredFlow(queryIt)
| I need a little more help, flow isn't easy to use if you aren't
| familiar with deferred, reactors, generators, etc.
Yes. This stuff isn't easy.
More information about the Twisted-Python