Deprecated django.utils.text.javascript_quote.

Refs #21725.
This commit is contained in:
Baptiste Mispelon 2014-02-21 14:46:23 +01:00
parent 847171b0d0
commit 926e18d7d1
5 changed files with 44 additions and 13 deletions

View file

@ -4,6 +4,7 @@ import re
import unicodedata
from gzip import GzipFile
from io import BytesIO
import warnings
from django.utils.encoding import force_text
from django.utils.functional import allow_lazy, SimpleLazyObject
@ -327,6 +328,11 @@ ustring_re = re.compile("([\u0080-\uffff])")
def javascript_quote(s, quote_double_quotes=False):
msg = (
"django.utils.text.javascript_quote() is deprecated. "
"Use django.utils.html.escapejs() instead."
)
warnings.warn(msg, PendingDeprecationWarning, stacklevel=2)
def fix(match):
return "\\u%04x" % ord(match.group(1))