Optimized View.dispatch() a bit.
Some checks are pending
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run

This commit is contained in:
sobolevn 2025-10-12 23:09:46 +03:00 committed by GitHub
parent 315dbe675d
commit 0f75f8f1ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)