Ticket #6529: escape_conditional_for_attrs.patch

File escape_conditional_for_attrs.patch, 859 bytes (added by antisvin, 16 years ago)
  • django/newforms/util.py

     
    1 from django.utils.html import escape
     1from django.utils.html import conditional_escape
    22from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode
    33from django.utils.functional import Promise
    44from django.utils.safestring import mark_safe
     
    1010    XML-style pairs.  It is assumed that the keys do not need to be XML-escaped.
    1111    If the passed dictionary is empty, then return an empty string.
    1212    """
    13     return u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
     13    return u''.join([u' %s="%s"' % (k, conditional_escape(v)) for k, v in attrs.items()])
    1414
    1515class ErrorDict(dict, StrAndUnicode):
    1616    """
Back to Top