Refs #27753 -- Removed django.utils.safestring.SafeBytes.
This commit is contained in:
parent
3004d7057f
commit
f09b0f6483
|
@ -18,27 +18,6 @@ class SafeData:
|
|||
return self
|
||||
|
||||
|
||||
class SafeBytes(bytes, SafeData):
|
||||
"""
|
||||
A bytes subclass that has been specifically marked as "safe" (requires no
|
||||
further escaping) for HTML output purposes.
|
||||
|
||||
Kept in Django 2.0 for usage by apps supporting Python 2. Shouldn't be used
|
||||
in Django anymore.
|
||||
"""
|
||||
def __add__(self, rhs):
|
||||
"""
|
||||
Concatenating a safe byte string with another safe byte string or safe
|
||||
string is safe. Otherwise, the result is no longer safe.
|
||||
"""
|
||||
t = super().__add__(rhs)
|
||||
if isinstance(rhs, SafeText):
|
||||
return SafeText(t)
|
||||
elif isinstance(rhs, SafeBytes):
|
||||
return SafeBytes(t)
|
||||
return t
|
||||
|
||||
|
||||
class SafeText(str, SafeData):
|
||||
"""
|
||||
A str subclass that has been specifically marked as "safe" for HTML output
|
||||
|
|
|
@ -274,6 +274,8 @@ Django 3.0, we're removing these APIs at this time.
|
|||
* ``django.utils.functional.curry()`` - Use :func:`functools.partial` or
|
||||
:class:`functools.partialmethod`. See :commit:`5b1c389603a353625ae1603`.
|
||||
|
||||
* ``django.utils.safestring.SafeBytes`` - Unused since Django 2.0.
|
||||
|
||||
Miscellaneous
|
||||
-------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue