From 1d4d52c9c97a24bfc0ea0c686df83aa32c51632b Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 9 Sep 2012 09:49:56 -0500 Subject: [PATCH] fixed issue 974, thanks Corne --- VERSION | 2 +- gluon/http.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 141b1319..276bbdf6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.8 (2012-09-09 09:20:41) stable +Version 2.0.8 (2012-09-09 09:49:53) stable diff --git a/gluon/http.py b/gluon/http.py index 69356b85..50134959 100644 --- a/gluon/http.py +++ b/gluon/http.py @@ -7,6 +7,8 @@ Copyrighted by Massimo Di Pierro License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ +import re + __all__ = ['HTTP', 'redirect'] defined_status = { @@ -56,6 +58,7 @@ try: except NameError: BaseException = Exception +regex_status = re.compile('^\d{3} \w+$') class HTTP(BaseException): @@ -83,7 +86,9 @@ class HTTP(BaseException): if status in defined_status: status = '%d %s' % (status, defined_status[status]) else: - status = str(status) + ' ' + status = str(status) + if not regex_status.match(status): + status = "500 UNKNOWN ERROR" if not 'Content-Type' in headers: headers['Content-Type'] = 'text/html; charset=UTF-8' body = self.body