Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor short names in exceptions #8585

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions rest_framework/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Handled exceptions raised by REST framework.

In addition Django's built in 403 and 404 exceptions are handled.
In addition, Django's built in 403 and 404 exceptions are handled.
(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
"""
import math
Expand Down Expand Up @@ -72,19 +72,19 @@ def __new__(cls, string, code=None):
return self

def __eq__(self, other):
r = super().__eq__(other)
if r is NotImplemented:
result = super().__eq__(other)
if result is NotImplemented:
return NotImplemented
try:
return r and self.code == other.code
return result and self.code == other.code
except AttributeError:
return r
return result

def __ne__(self, other):
r = self.__eq__(other)
if r is NotImplemented:
result = self.__eq__(other)
if result is NotImplemented:
return NotImplemented
return not r
return not result

def __repr__(self):
return 'ErrorDetail(string=%r, code=%r)' % (
Expand Down