Ticket #6529: escape_conditional_for_attrs.patch
File escape_conditional_for_attrs.patch, 859 bytes (added by , 17 years ago) |
---|
-
django/newforms/util.py
1 from django.utils.html import escape1 from django.utils.html import conditional_escape 2 2 from django.utils.encoding import smart_unicode, StrAndUnicode, force_unicode 3 3 from django.utils.functional import Promise 4 4 from django.utils.safestring import mark_safe … … 10 10 XML-style pairs. It is assumed that the keys do not need to be XML-escaped. 11 11 If the passed dictionary is empty, then return an empty string. 12 12 """ 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()]) 14 14 15 15 class ErrorDict(dict, StrAndUnicode): 16 16 """