Ticket #6353: 6353-2.diff

File 6353-2.diff, 1.3 KB (added by Thomas Güttler, 16 years ago)
  • django/utils/encoding.py

     
    4949        if not isinstance(s, basestring,):
    5050            if hasattr(s, '__unicode__'):
    5151                s = unicode(s)
     52            elif isinstance(s, Exception):
     53                try:
     54                    s = unicode(s)
     55                except UnicodeError:
     56                    if errors == 'replace':
     57                        s = ' '.join([force_unicode(arg, encoding, strings_only, errors) for arg in s.args])
     58                    else:
     59                        raise
    5260            else:
    5361                s = unicode(str(s), encoding, errors)
    5462        elif not isinstance(s, unicode):
  • django/views/debug.py

     
    177177        'root_urlconf': settings.ROOT_URLCONF,
    178178        'request_path': request.path[1:], # Trim leading slash
    179179        'urlpatterns': tried,
    180         'reason': str(exception),
     180        'reason': smart_unicode(exception, errors='replace'),
    181181        'request': request,
    182182        'request_protocol': request.is_secure() and "https" or "http",
    183183        'settings': get_safe_settings(),
Back to Top