[Twisted-Python] using defers with requests
Christopher Armstrong
radix at twistedmatrix.com
Sat Nov 15 21:06:06 MST 2003
On Sat, Nov 15, 2003 at 07:59:05PM -0800, charles brandt wrote:
> I added some print debug statements as follows:
>
> def printResult(data, request):
> print "entered printResult"
> request.write("pre-data")
> request.write(data)
> request.write("post-data")
> request.finish()
> print request
What is 'data' here? can you print repr(data)? It might be the empty
string, or something.
> return server.NOT_DONE_YET
This is unnecessary here, FYI.
> class myResource(resource.Resource):
> def render(self, request):
> print "entered render"
> d = getData("some string")
> d.addCallback(printResult, request)
> print "after callback"
> return server.NOT_DONE_YET
>
> resource = myResource()
--
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
---------+ http://radix.twistedmatrix.com/
More information about the Twisted-Python
mailing list