<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi:<br>
That's reasonable, I put them in a single method and it works. So I
should make my methods to fit for the default behaviour rather than
change it. (one result pass to be next args)<br>
Thank you.<br>
<br>
leslie<br>
Christopher Armstrong wrote:
<blockquote cite="mid60ed19d40505081920695b2de@mail.gmail.com"
type="cite">
<pre wrap="">For this particular example, I would suggest just putting them in a
single method, since request.write doesn't return a Deferred and you
don't need to wait for anything before doing the setHeader.
def gotResult(html):
request.write(html)
request.setHeader(key, value)
d.addCallback(gotResult)
In the general case, though, you can do something like
def gotResult(r):
request.write(r)
return r
d.addCallback(gotResult)
d.addCallback(anotherCallback)
On 5/9/05, Leslie Huyan <a class="moz-txt-link-rfc2396E" href="mailto:leslie@exoweb.net"><leslie@exoweb.net></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi:
I encountered one problem to dig into twisted.
If I have 2 methods in the call back chain, however I don't want the
result of the first one to pass to the second one as its arguments, what
should I do?
For example:
defer.addCallbacks(request.write, html)
defer.addCallbacks(request.setHeader, key, value)
Thank you.
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>