Removed unnecessary str type from @keep_lazy decorator for escape()/escapejs().
This commit is contained in:
parent
1299bc33e1
commit
b626c5a979
|
@ -14,7 +14,7 @@ from django.utils.safestring import SafeData, SafeString, mark_safe
|
||||||
from django.utils.text import normalize_newlines
|
from django.utils.text import normalize_newlines
|
||||||
|
|
||||||
|
|
||||||
@keep_lazy(str, SafeString)
|
@keep_lazy(SafeString)
|
||||||
def escape(text):
|
def escape(text):
|
||||||
"""
|
"""
|
||||||
Return the given text with ampersands, quotes and angle brackets encoded
|
Return the given text with ampersands, quotes and angle brackets encoded
|
||||||
|
@ -46,7 +46,7 @@ _js_escapes = {
|
||||||
_js_escapes.update((ord("%c" % z), "\\u%04X" % z) for z in range(32))
|
_js_escapes.update((ord("%c" % z), "\\u%04X" % z) for z in range(32))
|
||||||
|
|
||||||
|
|
||||||
@keep_lazy(str, SafeString)
|
@keep_lazy(SafeString)
|
||||||
def escapejs(value):
|
def escapejs(value):
|
||||||
"""Hex encode characters for use in JavaScript strings."""
|
"""Hex encode characters for use in JavaScript strings."""
|
||||||
return mark_safe(str(value).translate(_js_escapes))
|
return mark_safe(str(value).translate(_js_escapes))
|
||||||
|
|
Loading…
Reference in New Issue