Opened 10 years ago

Last modified 10 years ago

#3906 defect new

Cannot raise UnsupportedMethod in DeferredResource

Reported by: 107269088 Owned by:
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch:
Author:

Description

This is completely lame. Due to the way that exceptions are handled in a deferred and the fact that server.site.render relies on receiving the UnsupportedMethod exception for flow control, makes it impossible to really effectively use the DeferredResource.

Using exceptions for flow control may be pythonic, but it's wrong in this case. Arguably, UnsupportedMethod isn't all that exceptional considering how much processing it does. Better would be to have render return a special error code if it can't find a method for the specified HTTP METHOD instead of raising an exception.

Attachments (1)

test_deferred_resource.tac (2.0 KB) - added by 107269088 10 years ago.
twistd -n -l- -y ./test_deferred_resource.tac

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by 107269088

Attachment: test_deferred_resource.tac added

twistd -n -l- -y ./test_deferred_resource.tac

comment:1 Changed 10 years ago by 107269088

Run this command: twistd -n -l- -y ./test_deferred_resource.tac

And then send a PUT or POST or some other Unsupported Method to the server and you'll see what fun happens.

comment:2 Changed 10 years ago by Jean-Paul Calderone

Milestone: regular-releases
Priority: highestnormal

Yea, this is lame.

Removing from unrelated milestone, though.

comment:3 Changed 9 years ago by <automation>

Owner: jknight deleted
Note: See TracTickets for help on using tickets.