[Twisted-web] pgasync (was: /freeform_post!!random causes exceptions)

Andrea Arcangeli andrea at cpushare.com
Tue Jan 18 18:35:07 MST 2005

On Tue, Jan 18, 2005 at 04:05:09PM -0500, James Y Knight wrote:
> Or as a more likely example, you would feel free to make blocking calls 
> to (and therefore expect non-deferred results from) curs.execute() and 
> curs.fetch(). Which of course, *all* current code written for use with 
> runInteraction does!

Ok, I didn't know they were returning a deferred (from J example it
looked like .execute returned void, but anyway I missed .fetch requires
deferred). I'm also using .fetch() in the runInteration callback of

Perhaps it could be adapted with minimal modifications with
waitfordeferred + yield by checking if the return value of exec/fetch is
an instance of a deferred object? I ack I will have to change my code
somehow, but still I would like to write code that works with both
pgasync and adbapi, so the closest the pgasync2adbapi wrapper gets to
adbapi, the less messy code I will have to write.  While I'd like to
experiment with pgasync I must be able to go back to adbapi anytime.

So feel free to implement runInteration with a slightly different
semantic in the wrapper, you won't have to write the big fat warning
since the deferred at runtime will break executon of old code, and
adapting that bit by checking if the retval is a deferred, shouldn't be
too bad. And all other calls would be compatible. So it still looks
reasonable to have a wrapper.

More information about the Twisted-web mailing list