Kaydet (Commit) 3ecc84a8 authored tarafından Russell Keith-Magee's avatar Russell Keith-Magee

Added a logging call on HTTP 405 for class-based views. This is for consistency…

Added a logging call on HTTP 405 for class-based views. This is for consistency with function-based views.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst e1182306
......@@ -60,7 +60,7 @@ class View(object):
return view
def dispatch(self, request, *args, **kwargs):
# Try to dispatch to the right method for that; if it doesn't exist,
# Try to dispatch to the right method; if a method doesn't exist,
# defer to the error handler. Also defer to the error handler if the
# request method isn't on the approved list.
if request.method.lower() in self.http_method_names:
......@@ -74,6 +74,12 @@ class View(object):
def http_method_not_allowed(self, request, *args, **kwargs):
allowed_methods = [m for m in self.http_method_names if hasattr(self, m)]
logger.warning('Method Not Allowed (%s): %s' % (request.method, request.path),
extra={
'status_code': 405,
'request': self.request
}
)
return http.HttpResponseNotAllowed(allowed_methods)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment