pyramid_debugtoolbar and waitress leak support for non-english environments #77

xionglingfeng opened this Issue Sep 16, 2012 · 0 comments


None yet
1 participant

Development Environment:
Debian GNU/Linux wheezy (locale: zh_TW.UTF-8)
Python 2.7.3rc2

I wrote a page which would query and show content from my database, while the content stored in my database are all Chinese. If there is no errors on this page, everything works fine. But if this page raised errors, I will get this in browser:

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

in the console, I got his:

2012-09-10 09:31:27,486 ERROR [waitress][Dummy-2] Exception when serving /itemtype/1
Traceback (most recent call last):
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/", line 329, in service
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/", line 173, in service
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/", line 380, in execute
    app_iter =, start_response)
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/pyramid-1.3.3-py2.7.egg/pyramid/", line 187, in __call__
    response = self.handle_request(request)
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/pyramid_debugtoolbar-1.0.2-py2.7.egg/pyramid_debugtoolbar/", line 133, in toolbar_tween
    body = tb.render_full(request).encode('utf-8', 'replace')
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/pyramid_debugtoolbar-1.0.2-py2.7.egg/pyramid_debugtoolbar/", line 240, in render_full
    summary = self.render_summary(include_title=False, request=request)
  File "/home/bear/work/xxxx/pyenv/local/lib/python2.7/site-packages/pyramid_debugtoolbar-1.0.2-py2.7.egg/pyramid_debugtoolbar/", line 229, in render_summary
    'description':  description_wrapper % escape(self.exception),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 512: ordinal not in range(128)

Line 229 is not the only problem... there are more similar errors existed in pyramid_debugtoolbar.
If I removed pyramid_debugtoolbar form the development.ini, and I saw the bowser shown:

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

and in console:

AttributeError: 'ItemType' object has no attribute 'img'

 - Expression: "itemtype.img"
 - Filename:   None
 - Location:   (14:22)
 - Source:     <li tal:condition="itemtype.img">
 - Arguments:  repeat: {...} (0)
               renderer_name: ../templates/
               renderer_info: <RendererHelper - at 0x3c85690>
               imageserver: /static/images/
               itemtype: <ItemType - at 0x3d11d50>
               title: 测试商品
               request: <Request - at 0x3c85210>
               req: <Request - at 0x3c85210>
               amount: 0
               context: <instance None at 0x3ce78c0>
               view: <function itemtype_view at 0x3b99e60>

I believe it should show the error content in browser instead of a internal error page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment