On Fri, Nov 13, 2009 at 3:46 PM, <exarkun@twistedmatrix.com> wrote:
On 03:42 pm, landreville@deadtreepages.com wrote:
>On Fri, Nov 13, 2009 at 10:25 AM, <exarkun@twistedmatrix.com> wrote:
>>What is it that you're going to be doing in these SOAP methods?
>They are doing a bunch of setting and retrieving information from
>There are a couple that load more modules which add more SOAP methods
>interacting with a different database.
>None of the calls depend on eachother, so I don't want/need any of them
>block the application from processing the next soap call. Is there
>ways of generating deferreds without threads that I haven't seen?

There are lots of ways.  Deferreds are just an approach to organizing
callbacks.  If you're actually asking if there's a way to call blocking
functions without blocking - no, threads are more or less it (there's
processes too, but that's sort of the same thing).

Database access is definitely an area where you often have to deal with
blocking APIs.  If that's why your methods block, then threads might be
the right solution.  You might want to take a look at
twisted.enterprise.adbapi, a thread-based wrapper for DB-API 2.0

If you're blocking waiting for the network or other events, though, then
you can probably find a Twisted API to deal with that without using


Most of the time it is datbase access. I guess I shouldn't have chosen probiscus using the greentrunk api instead of the dbapi. I haven't been pleased by the postgres drivers in python, so I'm wary to change the db api and use adbapi around it.

Sometimes the calls are blocking because it is calling another SOAP server (or possibly itself over SOAP). My SOAP calls will all be blocking because twisted.web.soap doesn't support WSDL.
Other than db access and accessing soap calls the rest is just formatting the results. 

I'm thinking maybe I could make an attribute of my soap method called "deferred = True|False" and then if it's True render will wrap the call to the soap method in a deferred thread, otherwise I will defer blocking statements inside the SOAP method.