mirror of
https://github.com/django/django.git
synced 2025-11-19 19:24:46 +00:00
Optimized View.dispatch() a bit.
This commit is contained in:
parent
315dbe675d
commit
0f75f8f1ff
1 changed files with 3 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue