[Twisted-web] Problem with twisted web and adbapi

Phil Mayers p.mayers at imperial.ac.uk
Sat Jul 21 10:56:35 EDT 2007

> Request did not return a string
> Request:
> <GET / HTTP/1.1>
> Resource:
> <__main__.Simple instance at 0x1208878>
> Value:
> <Deferred at 0x124cfa8>
> Later when the _getUserList() returns the Defered object calles the
> cb() function and i get a printout with the wanted result.
> So I think my problem is that I whant to *wait* for the result from
> the db query before the render_GET() returns.

No, you definitely don't wait - that defeats the entire point of using
an event-driven system.




def render_GET(self, request):
    def cb(data):
    # note, we add our callback to the deferred then discard it
    # we *return* a special value
    return server.NOT_DONE_YET



More information about the Twisted-web mailing list