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 16:33:14 +0100
commit3d86eac2138d8d2c41ffb54fc1292a14acf3d5e7 (patch)
treed7b7e56a861c5907e56675d57555bcbc1fe7fbb0
parentf1a216cec765c77f4c5e7b66bfdfce9494c6a51b (diff)
downloadbottle-3d86eac2138d8d2c41ffb54fc1292a14acf3d5e7.tar.gz
Fixed a bug in HTTPError.__repr__. The repr() builtin breaks for non-ascii
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 2219930..8452bd1 100755
--- a/bottle.py
+++ b/bottle.py
@@ -227,7 +227,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 780399b..d3f8641 100755
--- a/test/test_wsgi.py
+++ b/test/test_wsgi.py
@@ -72,6 +72,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')