Skip to content

Commit cc7f4f5

Browse files
jleclancheCarlton Gibson
authored andcommitted
Fix missing six.text_type() call on APIException.__str__ (#5476)
Pull up method from subclass to superclass The call was added in 426547c to allow for dict-style arguments to ValidationError but does not apply to other APIException descendants.
1 parent 5dcb460 commit cc7f4f5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

rest_framework/exceptions.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __init__(self, detail=None, code=None):
9292
self.detail = _get_error_details(detail, code)
9393

9494
def __str__(self):
95-
return self.detail
95+
return six.text_type(self.detail)
9696

9797
def get_codes(self):
9898
"""
@@ -136,9 +136,6 @@ def __init__(self, detail=None, code=None):
136136

137137
self.detail = _get_error_details(detail, code)
138138

139-
def __str__(self):
140-
return six.text_type(self.detail)
141-
142139

143140
class ParseError(APIException):
144141
status_code = status.HTTP_400_BAD_REQUEST

0 commit comments

Comments
 (0)