summaryrefslogtreecommitdiff
path: root/django/utils/html.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-02 13:12:09 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-02 13:12:09 -0700
commit7548aa8ffd46eb6e0f73730d1b2eb515ba581f95 (patch)
tree963393779f4c8c33351ea605f708f8da7d9f70bf /django/utils/html.py
parent65c4ac3b2434d1828cb76c9f4454fe64e81354ee (diff)
More attacking E302 violators
Diffstat (limited to 'django/utils/html.py')
-rw-r--r--django/utils/html.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index 5b2416f03f..6d04ae5205 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -56,11 +56,13 @@ _js_escapes = {
# Escape every ASCII character with a value less than 32.
_js_escapes.update((ord('%c' % z), '\\u%04X' % z) for z in range(32))
+
def escapejs(value):
"""Hex encodes characters for use in JavaScript strings."""
return mark_safe(force_text(value).translate(_js_escapes))
escapejs = allow_lazy(escapejs, six.text_type)
+
def conditional_escape(text):
"""
Similar to escape(), except that it doesn't operate on pre-escaped strings.