Skip to content
Snippets Groups Projects
Commit 612c5e7b authored by Wannes Rombouts's avatar Wannes Rombouts
Browse files

Changed .message in the exceptions inheriting from HTTPError, hopefully this...

Changed .message in the exceptions inheriting from HTTPError, hopefully this will satisfy the depreciation warning.
parent 10c7d692
No related branches found
No related tags found
No related merge requests found
...@@ -52,62 +52,55 @@ def Created(location): ...@@ -52,62 +52,55 @@ def Created(location):
class BadRequest(web.webapi.HTTPError): class BadRequest(web.webapi.HTTPError):
"""`400 Bad Request` error.""" """`400 Bad Request` error."""
message = "bad request" def __init__(self, message="bad request"):
def __init__(self, message=None):
status = '404 Bad Request' status = '404 Bad Request'
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
class NotFound(web.webapi.HTTPError): class NotFound(web.webapi.HTTPError):
"""`404 Not Found` error.""" """`404 Not Found` error."""
message = "not found" def __init__(self, message="not found"):
def __init__(self, message=None):
status = '404 Not Found' status = '404 Not Found'
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
class Unauthorized(web.webapi.HTTPError): class Unauthorized(web.webapi.HTTPError):
"""`401 Unauthorized` error.""" """`401 Unauthorized` error."""
message = "unauthorized" def __init__(self, message="unauthorized"):
def __init__(self, message=None):
status = "401 Unauthorized" status = "401 Unauthorized"
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
class Forbidden(web.webapi.HTTPError): class Forbidden(web.webapi.HTTPError):
"""`403 Forbidden` error.""" """`403 Forbidden` error."""
message = "forbidden" def __init__(self, message="forbidden"):
def __init__(self, message=None):
status = "403 Forbidden" status = "403 Forbidden"
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
class Conflict(web.webapi.HTTPError): class Conflict(web.webapi.HTTPError):
"""`409 Conflict` error.""" """`409 Conflict` error."""
message = "conflict" def __init__(self, message="conflict"):
def __init__(self, message=None):
status = "409 Conflict" status = "409 Conflict"
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
class NotAcceptable(web.webapi.HTTPError): class NotAcceptable(web.webapi.HTTPError):
"""`406 Not Acceptable` error.""" """`406 Not Acceptable` error."""
message = "not acceptable" def __init__(self, message="not acceptable"):
def __init__(self, message=None):
status = "406 Not Acceptable" status = "406 Not Acceptable"
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
class NotImplemented(web.webapi.HTTPError): class NotImplemented(web.webapi.HTTPError):
"""`501 Not Implemented` error.""" """`501 Not Implemented` error."""
message = "not implemented" def __init__(self, message="not implemented"):
def __init__(self, message=None):
status = "501 Not Implemented" status = "501 Not Implemented"
headers = {'Content-Type': 'text/html'} headers = {'Content-Type': 'text/html'}
web.webapi.HTTPError.__init__(self, status, headers, message or self.message) web.webapi.HTTPError.__init__(self, status, headers, message)
# The folowing helpers are for managing exceptions and transforming them into http errors: # The folowing helpers are for managing exceptions and transforming them into http errors:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment