Commit 3e806875 by Tom Christie

Merge pull request #2055 from kevinlondon/patch-6

#2054: Update exceptions to allow custom detail
parents 62ce653c 9521b697
...@@ -70,7 +70,7 @@ class MethodNotAllowed(APIException): ...@@ -70,7 +70,7 @@ class MethodNotAllowed(APIException):
default_detail = "Method '%s' not allowed." default_detail = "Method '%s' not allowed."
def __init__(self, method, detail=None): def __init__(self, method, detail=None):
self.detail = (detail or self.default_detail) % method self.detail = detail or (self.default_detail % method)
class NotAcceptable(APIException): class NotAcceptable(APIException):
...@@ -87,7 +87,7 @@ class UnsupportedMediaType(APIException): ...@@ -87,7 +87,7 @@ class UnsupportedMediaType(APIException):
default_detail = "Unsupported media type '%s' in request." default_detail = "Unsupported media type '%s' in request."
def __init__(self, media_type, detail=None): def __init__(self, media_type, detail=None):
self.detail = (detail or self.default_detail) % media_type self.detail = detail or (self.default_detail % media_type)
class Throttled(APIException): class Throttled(APIException):
......
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