Django

Code

Ticket #4300: views_debug_py.diff

File views_debug_py.diff, 0.7 kB (added by Thomas Güttler <hv@tbz-pariv.de>, 2 years ago)
  • django/views/debug.py

    old new  
    122122            'function': '?', 
    123123            'lineno': '?', 
    124124        }] 
     125 
     126    # Exception values might contain unkown encodings. 
     127    # Example: Postgres might return latin1 strings. 
     128    try: 
     129        exc_value=str(exc_value).decode("latin1") 
     130    except UnicodeError: 
     131        exc_value=str(exc_value).decode("utf8", "replace") 
     132 
    125133    t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template') 
    126134    c = Context({ 
    127135        'exception_type': exc_type.__name__,