mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Optimized View.dispatch() a bit.
This commit is contained in:
@@ -136,10 +136,9 @@ class View:
|
||||
# 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:
|
||||
handler = getattr(
|
||||
self, request.method.lower(), self.http_method_not_allowed
|
||||
)
|
||||
method = request.method.lower()
|
||||
if method in self.http_method_names:
|
||||
handler = getattr(self, method, self.http_method_not_allowed)
|
||||
else:
|
||||
handler = self.http_method_not_allowed
|
||||
return handler(request, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user