Ticket #4367: debug_py.diff

File debug_py.diff, 1.6 KB (added by Thomas Güttler <hv@…>, 8 years ago)
  • django/views/debug.py

     
    420420                {% for var in frame.vars|dictsort:"0" %}
    421421                  <tr>
    422422                    <td>{{ var.0 }}</td>
    423                     <td class="code"><div>{{ var.1|pprint|escape }}</div></td>
     423                    <td class="code"><div>{{ var.1|pprint|escape|smart_unicode_replace }}</div></td>
    424424                  </tr>
    425425                {% endfor %}
    426426              </tbody>
  • django/template/defaultfilters.py

     
    33from django.template import resolve_variable, Library
    44from django.conf import settings
    55from django.utils.translation import ugettext, ungettext
    6 from django.utils.encoding import force_unicode, smart_str, iri_to_uri
     6from django.utils.encoding import force_unicode, smart_str, iri_to_uri, smart_unicode
    77import re
    88import random as random_module
    99
     
    554554    except Exception, e:
    555555        return u"Error in formatting:%s" % force_unicode(e)
    556556
     557def smart_unicode_replace(value):
     558    return smart_unicode(value, errors='replace')
     559
    557560# Syntax: register.filter(name of filter, callback)
    558561register.filter(add)
    559562register.filter(addslashes)
     
    606609register.filter(wordcount)
    607610register.filter(wordwrap)
    608611register.filter(yesno)
     612register.filter(smart_unicode_replace)
Back to Top