fixed issue 1604:After web2py Upgrade, int status codes are no longer respected, thanks cfhowes

This commit is contained in:
mdipierro committed 2013-07-25 05:14:54 -05:00
1 parent ccdbb9a588
commit 61f5522661
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 2.6.0-development+timestamp.2013.07.25.05.11.38 Version 2.6.0-development+timestamp.2013.07.25.05.14.06
+3
View File
@@ -27,6 +27,7 @@ defined_status = {
307: 'TEMPORARY REDIRECT', 307: 'TEMPORARY REDIRECT',
400: 'BAD REQUEST', 400: 'BAD REQUEST',
401: 'UNAUTHORIZED', 401: 'UNAUTHORIZED',
402: 'PAYMENT REQUIRED',
403: 'FORBIDDEN', 403: 'FORBIDDEN',
404: 'NOT FOUND', 404: 'NOT FOUND',
405: 'METHOD NOT ALLOWED', 405: 'METHOD NOT ALLOWED',
@@ -79,6 +80,8 @@ class HTTP(Exception):
headers = self.headers headers = self.headers
if status in defined_status: if status in defined_status:
status = '%d %s' % (status, defined_status[status]) status = '%d %s' % (status, defined_status[status])
elif isinstance(status, int):
status = '%d UNKNOWN ERROR' % status
else: else:
status = str(status) status = str(status)
if not regex_status.match(status): if not regex_status.match(status):