Removed redundant check

This commit is contained in:
enrico 2022-08-25 17:45:58 +08:00
parent 0a4001086b
commit ae84d97d9a

View File

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