diff options
| author | Tim Graham <timograham@gmail.com> | 2015-01-17 12:41:49 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-01-17 12:41:49 -0500 |
| commit | df3f3bbe2927b9bad80088c6adbf5e8c5ba778c9 (patch) | |
| tree | 00128f399251cea6067133a0ca83df263eb55c24 /django/utils/text.py | |
| parent | 00a11994a57312687b9e104d2de370b139a28358 (diff) | |
Removed utils.text.javascript_quote() per deprecation timeline; refs #21725.
Diffstat (limited to 'django/utils/text.py')
| -rw-r--r-- | django/utils/text.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/django/utils/text.py b/django/utils/text.py index 37bcd3150e..88c38f4b2f 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -4,9 +4,7 @@ import re import unicodedata from gzip import GzipFile from io import BytesIO -import warnings -from django.utils.deprecation import RemovedInDjango19Warning from django.utils.encoding import force_text from django.utils.functional import allow_lazy, SimpleLazyObject from django.utils import six @@ -328,33 +326,6 @@ def compress_sequence(sequence): zfile.close() yield buf.read() -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, RemovedInDjango19Warning, stacklevel=2) - - def fix(match): - return "\\u%04x" % ord(match.group(1)) - - if type(s) == bytes: - s = s.decode('utf-8') - elif type(s) != six.text_type: - raise TypeError(s) - s = s.replace('\\', '\\\\') - s = s.replace('\r', '\\r') - s = s.replace('\n', '\\n') - s = s.replace('\t', '\\t') - s = s.replace("'", "\\'") - s = s.replace('</', '<\\/') - if quote_double_quotes: - s = s.replace('"', '"') - return ustring_re.sub(fix, s) -javascript_quote = allow_lazy(javascript_quote, six.text_type) # Expression to match some_token and some_token="with spaces" (and similarly # for single-quoted strings). |
