Commit a09682fd authored by Adrian Holovaty's avatar Adrian Holovaty
Browse files

Fixed #2185 -- Changed django.views.decorators.http.require_http_methods...

Fixed #2185 -- Changed django.views.decorators.http.require_http_methods decorator to use HttpResponseNotAllowed instead of HttpResponseForbidden

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 551a0272
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ Decorators for views based on HTTP headers.

from django.utils.decorators import decorator_from_middleware
from django.middleware.http import ConditionalGetMiddleware
from django.http import HttpResponseForbidden
from django.http import HttpResponseNotAllowed

conditional_page = decorator_from_middleware(ConditionalGetMiddleware)

@@ -23,7 +23,7 @@ def require_http_methods(request_method_list):
        def inner(request, *args, **kwargs):
            method = request.META.get("REQUEST_METHOD", None)
            if method not in request_method_list:
                raise HttpResponseForbidden("REQUEST_METHOD '%s' not allowed" % method)
                return HttpResponseNotAllowed(request_method_list)
            return func(request, *args, **kwargs)
        return inner
    return decorator