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:34:51 +0100
commit342d3f62409e1bff057ae9d964ac8848d79e5016 (patch)
tree068a71c54fbc1c474eff654ca4b020d2615007a3
parent24768b618a6e07dff5bfbd1527ed6a52a328277e (diff)
downloadbottle-342d3f62409e1bff057ae9d964ac8848d79e5016.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 6b55c22..998d8e4 100755
--- a/bottle.py
+++ b/bottle.py
@@ -233,7 +233,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 19543c9..953ee30 100755
--- a/test/test_wsgi.py
+++ b/test/test_wsgi.py
@@ -76,6 +76,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')