Created
March 3, 2015 13:12
-
-
Save nottrobin/5b7fc7fd8ae08c2b1ea3 to your computer and use it in GitHub Desktop.
PrettyAuthenticationFailed exception for djangorestframework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from rest_framework.exceptions import AuthenticationFailed | |
| class PrettyAuthenticationFailed(AuthenticationFailed): | |
| """ | |
| A fork of the djangorestframework AuthenticationFailed exception | |
| to simply allow the `detail` parameter to contain fully formed | |
| JSON objects, rather than just text | |
| """ | |
| def __init__(self, detail=None): | |
| if detail is not None: | |
| self.detail = detail | |
| else: | |
| self.detail = force_text(self.default_detail) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment