<br><br><div class="gmail_quote">On Fri, Nov 13, 2009 at 3:46 PM,  <span dir="ltr">&lt;<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 03:42 pm, <a href="mailto:landreville@deadtreepages.com">landreville@deadtreepages.com</a> wrote:<br>
&gt;On Fri, Nov 13, 2009 at 10:25 AM, &lt;<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>&gt; wrote:<br>
&gt;<br>
</div>&gt;[snip]<br>
<div class="im">&gt;&gt;<br>
&gt;&gt;What is it that you&#39;re going to be doing in these SOAP methods?<br>
&gt;&gt;<br>
&gt;&gt;Jean-Paul<br>
&gt;They are doing a bunch of setting and retrieving information from<br>
&gt;databases.<br>
&gt;There are a couple that load more modules which add more SOAP methods<br>
&gt;for<br>
&gt;interacting with a different database.<br>
&gt;<br>
&gt;None of the calls depend on eachother, so I don&#39;t want/need any of them<br>
&gt;to<br>
&gt;block the application from processing the next soap call. Is there<br>
&gt;other<br>
&gt;ways of generating deferreds without threads that I haven&#39;t seen?<br>
<br>
</div>There are lots of ways.  Deferreds are just an approach to organizing<br>
callbacks.  If you&#39;re actually asking if there&#39;s a way to call blocking<br>
functions without blocking - no, threads are more or less it (there&#39;s<br>
processes too, but that&#39;s sort of the same thing).<br>
<br>
Database access is definitely an area where you often have to deal with<br>
blocking APIs.  If that&#39;s why your methods block, then threads might be<br>
the right solution.  You might want to take a look at<br>
twisted.enterprise.adbapi, a thread-based wrapper for DB-API 2.0<br>
modules.<br>
<br>
If you&#39;re blocking waiting for the network or other events, though, then<br>
you can probably find a Twisted API to deal with that without using<br>
threads.<br>
<div><div></div><div class="h5"><br>
Jean-Paul<br><br>
</div></div></blockquote></div><br><div>Most of the time it is datbase access. I guess I shouldn&#39;t have chosen probiscus using the greentrunk api instead of the dbapi. I haven&#39;t been pleased by the postgres drivers in python, so I&#39;m wary to change the db api and use adbapi around it.</div>
<div><br></div><div>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&#39;t support WSDL.</div><div>
Other than db access and accessing soap calls the rest is just formatting the results. </div><div><br></div><div>I&#39;m thinking maybe I could make an attribute of my soap method called &quot;deferred = True|False&quot; and then if it&#39;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.</div>