mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Removed redundant check
This commit is contained in:
parent
0a4001086b
commit
ae84d97d9a
|
@ -1,8 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Provides an APIView class that is the base of all views in REST framework.
|
Provides an APIView class that is the base of all views in REST framework.
|
||||||
"""
|
"""
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.db import connections, models
|
from django.db import connections, models
|
||||||
|
@ -534,10 +532,7 @@ class APIView(View):
|
||||||
else:
|
else:
|
||||||
handler = self.http_method_not_allowed
|
handler = self.http_method_not_allowed
|
||||||
|
|
||||||
if asyncio.iscoroutinefunction(handler):
|
response = await handler(request, *args, **kwargs)
|
||||||
response = await handler(request, *args, **kwargs)
|
|
||||||
else:
|
|
||||||
raise Exception('Async methods should be used on an async view.')
|
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
response = self.handle_exception(exc)
|
response = self.handle_exception(exc)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user