diff options
| author | Tim Graham <timograham@gmail.com> | 2016-12-31 12:43:30 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-01-17 20:52:04 -0500 |
| commit | 60ca37d2e56e435521a4aa5ba56b1b11cb2a78e5 (patch) | |
| tree | 19fed3a6c8411aef6892b22032f4325014c78ee7 /django/utils | |
| parent | 0dfc5479a8e50215866bbf43604bed8416a1b504 (diff) | |
Refs #24046 -- Removed mark_for_escaping() per deprecation timeline.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/safestring.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/django/utils/safestring.py b/django/utils/safestring.py index 76136d0b0c..4355a050a0 100644 --- a/django/utils/safestring.py +++ b/django/utils/safestring.py @@ -4,39 +4,11 @@ without further escaping in HTML. Marking something as a "safe string" means that the producer of the string has already turned characters that should not be interpreted by the HTML engine (e.g. '<') into the appropriate entities. """ -import warnings from django.utils import six -from django.utils.deprecation import RemovedInDjango20Warning from django.utils.functional import Promise, curry, wraps -class EscapeData(object): - pass - - -class EscapeBytes(bytes, EscapeData): - """ - A byte string that should be HTML-escaped when output. - """ - pass - - -class EscapeText(six.text_type, EscapeData): - """ - A unicode string object that should be HTML-escaped when output. - """ - pass - - -if six.PY3: - EscapeString = EscapeText -else: - EscapeString = EscapeBytes - # backwards compatibility for Python 2 - EscapeUnicode = EscapeText - - class SafeData(object): def __html__(self): """ @@ -144,21 +116,3 @@ def mark_safe(s): if callable(s): return _safety_decorator(mark_safe, s) return SafeString(str(s)) - - -def mark_for_escaping(s): - """ - Explicitly mark a string as requiring HTML escaping upon output. Has no - effect on SafeData subclasses. - - Can be called multiple times on a single string (the resulting escaping is - only applied once). - """ - warnings.warn('mark_for_escaping() is deprecated.', RemovedInDjango20Warning) - if hasattr(s, '__html__') or isinstance(s, EscapeData): - return s - if isinstance(s, bytes) or (isinstance(s, Promise) and s._delegate_bytes): - return EscapeBytes(s) - if isinstance(s, (six.text_type, Promise)): - return EscapeText(s) - return EscapeString(str(s)) |
