Django

Code

Ticket #1646 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

[patch] HttpResponseNotAllowed to return '405's

Reported by: Ian@holsman.net Assigned to: mtredinnick
Milestone: Component: Core framework
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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)

Attachments

Change History

06/18/06 01:49:51 changed by mtredinnick

  • owner changed from adrian to mtredinnick.

This is a pre-requisite to fixing #2185.

06/18/06 21:04:41 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #1646 ([patch] HttpResponseNotAllowed to return '405's)




Change Properties
Action