Ticket #11778: patch.diff
File patch.diff, 885 bytes (added by , 15 years ago) |
---|
-
django/template/defaultfilters.py
85 85 _js_escapes = (_base_js_escapes + 86 86 tuple([('%c' % z, '\\x%02X' % z) for z in range(32)])) 87 87 88 _js_escapes_dict={} 89 for k, v in _js_escapes: 90 _js_escapes_dict[k]=v 91 92 _js_escapes_re = re.compile(u'[\u0000-\u001f]|\\\\|\'|"|>|<|&|=|-|;') 93 88 94 def escapejs(value): 89 """Hex encodes characters for use in JavaScript strings.""" 90 for bad, good in _js_escapes: 91 value = value.replace(bad, good) 92 return value 95 """Hex encodes characters for use in JavaScript strings.""" 96 return _js_escapes_re.sub(lambda m: _js_escapes_dict[m.group(0)], value) 93 97 escapejs = stringfilter(escapejs) 94 98 95 99 def fix_ampersands(value):