From 61f552266135ce9ae9573ffe44972ab66770e56e Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 25 Jul 2013 05:14:54 -0500 Subject: [PATCH] fixed issue 1604:After web2py Upgrade, int status codes are no longer respected, thanks cfhowes --- VERSION | 2 +- gluon/http.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 5621a1b3..795c9f19 100644 --- a/VERSION +++ b/VERSION @@ -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 diff --git a/gluon/http.py b/gluon/http.py index dda977b5..6f1b2e1e 100644 --- a/gluon/http.py +++ b/gluon/http.py @@ -27,6 +27,7 @@ defined_status = { 307: 'TEMPORARY REDIRECT', 400: 'BAD REQUEST', 401: 'UNAUTHORIZED', + 402: 'PAYMENT REQUIRED', 403: 'FORBIDDEN', 404: 'NOT FOUND', 405: 'METHOD NOT ALLOWED', @@ -79,6 +80,8 @@ class HTTP(Exception): headers = self.headers if status in defined_status: status = '%d %s' % (status, defined_status[status]) + elif isinstance(status, int): + status = '%d UNKNOWN ERROR' % status else: status = str(status) if not regex_status.match(status):