Code

Opened 8 years ago

Closed 8 years ago

#2185 closed defect (fixed)

require_http_methods "raise"s HttpResponseForbidden

Reported by: Maniac@… Owned by: mtredinnick
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Maniac@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

django.views.decorators.http.require_http_methods in case of invalid method "raise"s an instance of HttpResponseForbidden which is not an Exception. Now it ends up in a form of 500 error.

I think we need an exceptions similar to Http404 for this case. Not sure if it should be called Http403 or HttpForbidden...

Attachments (0)

Change History (6)

comment:1 Changed 8 years ago by anonymous

  • Cc Maniac@… added

comment:2 Changed 8 years ago by mtredinnick

This will be fixed by #1646 (which is on my list to commit shortly).

comment:3 Changed 8 years ago by mtredinnick

  • Owner changed from adrian to mtredinnick

comment:4 Changed 8 years ago by anonymous

BTW if the decorator would just return HttpResponseNotAlowed with some default message this won't be localizable (nor pretty). I'm starting to think that all "negative" HTTP answers should be treated like 404 and 500 now, allowing for custom template and view.

comment:5 Changed 8 years ago by mtredinnick

The 405 error typically does not have a body, just a list of HTTP methods that *are* acceptable in a subsequent retry. So this doesn't have any internationalization impact.

comment:6 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [3163]) Fixed #2185 -- Changed django.views.decorators.http.require_http_methods decorator to use HttpResponseNotAllowed instead of HttpResponseForbidden

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.