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