<pre><br>Hello and thanks for your time.<br><br>Regards,<br><br><br></pre><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">I've already written this some times:<br>
<br>d1.addCallback(5, reactor.callLater, d2.callback, "firelater")<br><br>Hope this, helps,<br><br>-- <br>Amaury Forgeot d'Arc<br><br></blockquote><blockquote><br><br><div class="gmail_quote">On Tue, Dec 16, 2008 at 5:29 PM, Arye <span dir="ltr"><<a href="mailto:aryeh@bigfoot.com">aryeh@bigfoot.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Dear list,<br><br>I would like to add a callback that delays the chain. In other words I would like to combine:<br>
defer.Deferred().addCallback<br>and reactor.callLater <br><br>The only solution I came up with was the code below.<br>
<br>There must be a more elegant way to do this.<br>Any ideas would be greatly appreciated,<br>All the best,<br><br>*************************begin<br>from twisted.internet import reactor, defer<br><br>def printResults(results, arg):<br>
print "In printResults results=", results<br> print "In printResults arg=", arg<br> if arg == 2:<br> reactor.stop()<br><br><br>def fireLater(results, d2):<br> print "In fireLater results=", results<br>
reactor.callLater(5, d2.callback, "firelater")<br><br>d1 = defer.Deferred()<br>d2 = defer.Deferred()<br>d2.addCallback( printResults, 1)<br>d2.addCallback( printResults, 2)<br><br><br>d1.addCallback(fireLater, d2)<br>
d1.callback("fire")<br><br>reactor.run()<br>*************************end<br>
</blockquote></div></blockquote><br>