Django

Code

Ticket #6353: 6353.diff

File 6353.diff, 1.1 kB (added by Karen Tracey <kmtracey@gmail.com>, 10 months ago)
  • django/views/debug.py

    old new  
    184184        'root_urlconf': settings.ROOT_URLCONF, 
    185185        'request_path': request.path[1:], # Trim leading slash 
    186186        'urlpatterns': tried, 
    187         'reason': str(exception), 
     187        'reason': smart_unicode(exception, errors='replace'), 
    188188        'request': request, 
    189189        'request_protocol': request.is_secure() and "https" or "http", 
    190190        'settings': get_safe_settings(), 
  • django/utils/encoding.py

    old new  
    4949        if not isinstance(s, basestring,): 
    5050            if hasattr(s, '__unicode__'): 
    5151                s = unicode(s) 
     52            elif isinstance(s, Exception): 
     53                s = ' '.join([force_unicode(arg, encoding, strings_only, errors) for arg in s.args]) 
    5254            else: 
    5355                s = unicode(str(s), encoding, errors) 
    5456        elif not isinstance(s, unicode):