summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2011-12-22 16:29:10 +0100
committerMarcel Hellkamp <marc@gsites.de>2011-12-22 19:45:42 +0100
commit8290992b058ae616ac42e86d125b6a38ce3136d8 (patch)
treec92a3dee7ee77d5a03e66eb7523c0d50a1d3fcaf
parent58440a5d88597357978e1437c50d57beb9868dec (diff)
downloadbottle-8290992b058ae616ac42e86d125b6a38ce3136d8.tar.gz
Fixed a bug in HTTPError.__repr__. The repr() builtin breaks for non-ascii0.9.8
unicode strings.
-rwxr-xr-xbottle.py2
-rwxr-xr-xtest/test_wsgi.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/bottle.py b/bottle.py
index 78d88c8..26b3478 100755
--- a/bottle.py
+++ b/bottle.py
@@ -192,7 +192,7 @@ class HTTPError(HTTPResponse):
self.traceback = traceback
def __repr__(self):
- return template(ERROR_PAGE_TEMPLATE, e=self)
+ return tonat(template(ERROR_PAGE_TEMPLATE, e=self))
diff --git a/test/test_wsgi.py b/test/test_wsgi.py
index 8c3edce..d037cc9 100755
--- a/test/test_wsgi.py
+++ b/test/test_wsgi.py
@@ -77,6 +77,11 @@ class TestWsgi(ServerTestBase):
def test(): return 1/0
self.assertStatus(500, '/')
+ def test_500_unicode(self):
+ @bottle.route('/')
+ def test(): raise Exception(touni('Unicode äöüß message.'))
+ self.assertStatus(500, '/')
+
def test_utf8_url(self):
""" WSGI: Exceptions within handler code (HTTP 500) """
@bottle.route('/my/:string')