Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#1646 closed enhancement (fixed)

[patch] HttpResponseNotAllowed to return '405's

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

Description

from RFC 2616: An origin server SHOULD return the status code 405 (Method Not Allowed) if the method is known by the origin server but not allowed for the requested resource.

Index: /magik/django/http/__init__.py
===================================================================
--- /magik/django/http/__init__.py      (revision 2704)
+++ /magik/django/http/__init__.py      (working copy)
@@ -265,6 +265,11 @@
         HttpResponse.__init__(self, *args, **kwargs)
         self.status_code = 403
 
+class HttpResponseNotAllowed(HttpResponse):
+    def __init__(self, *args, **kwargs):
+        HttpResponse.__init__(self, *args, **kwargs)
+        self.status_code = 405
+
 class HttpResponseGone(HttpResponse):
     def __init__(self, *args, **kwargs):
         HttpResponse.__init__(self, *args, **kwargs)

Change History (2)

comment:1 by Malcolm Tredinnick, 18 years ago

Owner: changed from Adrian Holovaty to Malcolm Tredinnick

This is a pre-requisite to fixing #2185.

comment:2 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [3144]) Fixed #1646 -- Added HttpResponseNotAllowed, as suggested by Ian Holsman.

Note: See TracTickets for help on using tickets.
Back to Top