[Twisted-Python] Re: @raise and deferreds

Michael Hudson mwh at python.net
Sat Jun 17 13:48:14 EDT 2006

David Reid <dreid at dreid.org> writes:

>>   Is that making any sense?  Alternatively, we could make up a new
>> keyword (@errback?), but I don't know how troublesome doing so is.  If
>> we do that, maybe another keyword (@callback) makes sense as well.
> I think that would be good, we should ask mwh to do that.

This turns out to be fairly easy.  This markup:

    def renderHTTP(req):
        """Return an IResponse or a deferred which will fire an
        IResponse. This response will be written to the web browser
        which initiated the request.

        @errback FooError: if it's too fooey.
        @errback BarError: if there is any bar; this is foo, not bar.
        @errback HolyCrapError: if your pants are on fire.

(function chosen entirely at random) produces this output:


Producing something better than "Unknown Field: errback" is a matter
of a little typing; ideas welcome :)


  I believe C++ instills fear in programmers, fear that the
  interaction of some details causes unpredictable results.
                                        -- Erik Naggum, comp.lang.lisp

More information about the Twisted-Python mailing list