Commit 89e9fc98 by José Padilla

Reuse exception_handler variable throughout

parent fd003fce
...@@ -371,16 +371,18 @@ class APIView(View): ...@@ -371,16 +371,18 @@ class APIView(View):
else: else:
exc.status_code = status.HTTP_403_FORBIDDEN exc.status_code = status.HTTP_403_FORBIDDEN
if len(inspect.getargspec(self.settings.EXCEPTION_HANDLER).args) == 1: exception_handler = self.settings.EXCEPTION_HANDLER
if len(inspect.getargspec(exception_handler).args) == 1:
warnings.warn( warnings.warn(
'The `exception_handler(exc)` call signature is deprecated. ' 'The `exception_handler(exc)` call signature is deprecated. '
'Use `exception_handler(exc, context) instead.', 'Use `exception_handler(exc, context) instead.',
PendingDeprecationWarning PendingDeprecationWarning
) )
response = self.settings.EXCEPTION_HANDLER(exc) response = exception_handler(exc)
else: else:
context = self.get_renderer_context() context = self.get_renderer_context()
response = self.settings.EXCEPTION_HANDLER(exc, context) response = exception_handler(exc, context)
if response is None: if response is None:
raise raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment