fixed issue 974, thanks Corne
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.0.8 (2012-09-09 09:20:41) stable
|
Version 2.0.8 (2012-09-09 09:49:53) stable
|
||||||
|
|||||||
+6
-1
@@ -7,6 +7,8 @@ Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
|
|||||||
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
|
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
__all__ = ['HTTP', 'redirect']
|
__all__ = ['HTTP', 'redirect']
|
||||||
|
|
||||||
defined_status = {
|
defined_status = {
|
||||||
@@ -56,6 +58,7 @@ try:
|
|||||||
except NameError:
|
except NameError:
|
||||||
BaseException = Exception
|
BaseException = Exception
|
||||||
|
|
||||||
|
regex_status = re.compile('^\d{3} \w+$')
|
||||||
|
|
||||||
class HTTP(BaseException):
|
class HTTP(BaseException):
|
||||||
|
|
||||||
@@ -83,7 +86,9 @@ class HTTP(BaseException):
|
|||||||
if status in defined_status:
|
if status in defined_status:
|
||||||
status = '%d %s' % (status, defined_status[status])
|
status = '%d %s' % (status, defined_status[status])
|
||||||
else:
|
else:
|
||||||
status = str(status) + ' '
|
status = str(status)
|
||||||
|
if not regex_status.match(status):
|
||||||
|
status = "500 UNKNOWN ERROR"
|
||||||
if not 'Content-Type' in headers:
|
if not 'Content-Type' in headers:
|
||||||
headers['Content-Type'] = 'text/html; charset=UTF-8'
|
headers['Content-Type'] = 'text/html; charset=UTF-8'
|
||||||
body = self.body
|
body = self.body
|
||||||
|
|||||||
Reference in New Issue
Block a user