<div>Thanks, Tristan and Colin.</div><div>Yes. the code was taken from storm unittests.</div><div><br></div><div>I was planning to do some rendering work in <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">cb_result.</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Let me try first.</span></font></div><br><br><div class="gmail_quote">On Thu, Jul 9, 2009 at 9:59 AM, Tristan Seligmann <span dir="ltr">&lt;<a href="mailto:mithrandi@mithrandi.net">mithrandi@mithrandi.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Thu, Jul 9, 2009 at 3:30 AM, Daniel Yang&lt;<a href="mailto:daniel.yang.zhenyu@gmail.com">daniel.yang.zhenyu@gmail.com</a>&gt; wrote:<br>

&gt; def test_execute(self):<br>
<br>
This looks like a unit test, not Nevow code?<br>
<div class="im"><br>
&gt;     def cb_execute(result):<br>
&gt;         #this result is a DeferredResult, not the actual data.<br>
&gt;         return result.get_one().addCallback(cb_result)<br>
&gt;     def cb_result(result):<br>
&gt;         #the data returns<br>
&gt;          print result<br>
<br>
</div>Return your ultimate result here; note that if you&#39;re not actually<br>
going to do anything to result in cb_result, you could just have:<br>
<br>
def cb_execute(result):<br>
    return result.get_one()<br>
<div class="im"><br>
&gt;     self.store.execute(&quot;SELECT title FROM foo WHERE id=10&quot;).addCallback(cb_execute)<br>
&gt;     return ?<br>
<br>
</div>return self.store.execute(&quot;SELECT title FROM foo WHERE<br>
<div class="im">id=10&quot;).addCallback(cb_execute)<br>
<br>
</div>The result returned from cb_result is what will ultimately used by<br>
whatever invoked test_execute, assuming that it pays attention to the<br>
return value; I&#39;m not clear how test_execute is being used, so I can&#39;t<br>
say this will work for sure. If test_execute is, for example, a render<br>
method, then it should work just fine.<br>
<font color="#888888">--<br>
mithrandi, i Ainil en-Balandor, a faer Ambar<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
Twisted-web mailing list<br>
<a href="mailto:Twisted-web@twistedmatrix.com">Twisted-web@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-----------------------------------------------<br>Yours<br>Faithfully<br><br>Daniel Yang<br>