[Twisted-Python] Question about Using Deferreds in ServerProtocol request Handler

Tristan Seligmann mithrandi at mithrandi.za.net
Wed Feb 20 17:38:56 MST 2008


* Jean-Paul Calderone <exarkun at divmod.com> [2008-02-20 11:18:28 -0500]:

>        try:
>            d = client.getPage("http://www.google.com")
>        except Exception:
>            d = failure.Failure()

I guess this should be:

       try:
           d = client.getPage("http://www.google.com")
       except Exception:
           d = defer.fail()

Alternatively:

        d = maybeDeferred(client.getPage, "http://www.google.com")

although that's probably maybeDeferred() abuse.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: </pipermail/twisted-python/attachments/20080221/da723874/attachment.sig>


More information about the Twisted-Python mailing list