summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-01-26 09:37:07 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-30 15:04:45 +0100
commit52138b1fd08f80fe98def7e22a9693415b4f7744 (patch)
tree83a4e3c95bac121d0cc661ed2e637ad99fe322e4 /docs
parent277a4dd4b4cc2a2cad77139882f084480751a95a (diff)
Refs #23919 -- Removed usage of obsolete SafeBytes class
The class will be removed as part of #27753. Thanks Tim Graham for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/howto/custom-template-tags.txt10
-rw-r--r--docs/ref/utils.txt10
-rw-r--r--docs/releases/2.0.txt10
3 files changed, 17 insertions, 13 deletions
diff --git a/docs/howto/custom-template-tags.txt b/docs/howto/custom-template-tags.txt
index 9ce743549d..d568292229 100644
--- a/docs/howto/custom-template-tags.txt
+++ b/docs/howto/custom-template-tags.txt
@@ -199,11 +199,13 @@ passed around inside the template code:
They're commonly used for output that contains raw HTML that is intended
to be interpreted as-is on the client side.
- Internally, these strings are of type ``SafeBytes`` or ``SafeText``.
- They share a common base class of ``SafeData``, so you can test
- for them using code like::
+ Internally, these strings are of type
+ :class:`~django.utils.safestring.SafeText`. You can test for them
+ using code like::
- if isinstance(value, SafeData):
+ from django.utils.safestring import SafeText
+
+ if isinstance(value, SafeText):
# Do something with the "safe" string.
...
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt
index cd5bbee707..1e37d28ca8 100644
--- a/docs/ref/utils.txt
+++ b/docs/ref/utils.txt
@@ -763,20 +763,12 @@ 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.
-.. class:: SafeBytes
-
- A ``bytes`` subclass that has been specifically marked as "safe"
- (requires no further escaping) for HTML output purposes.
-
.. class:: SafeString
A ``str`` subclass that has been specifically marked as "safe"
(requires no further escaping) for HTML output purposes. Alias of
:class:`SafeText`.
- Alias of :class:`SafeBytes` on Python 2 (in older versions of Django that
- support it).
-
.. class:: SafeText
A ``str`` subclass that has been specifically marked as "safe" for HTML
@@ -799,7 +791,7 @@ appropriate entities.
>>> mystr = '<b>Hello World</b> '
>>> mystr = mark_safe(mystr)
>>> type(mystr)
- <class 'django.utils.safestring.SafeBytes'>
+ <class 'django.utils.safestring.SafeText'>
>>> mystr = mystr.strip() # removing whitespace
>>> type(mystr)
diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt
index 7cb9b5da73..dec2b85228 100644
--- a/docs/releases/2.0.txt
+++ b/docs/releases/2.0.txt
@@ -205,6 +205,16 @@ Validators
Backwards incompatible changes in 2.0
=====================================
+Removed support for bytestrings in some places
+----------------------------------------------
+
+To support native Python 2 strings, older Django versions had to accept both
+bytestrings and unicode strings. Now that Python 2 support is dropped,
+bytestrings should only be encountered around input/output boundaries (handling
+of binary fields or HTTP streams, for example). You might have to update your
+code to limit bytestring usage to a minimum, as Django no longer accepts
+bytestrings in certain code paths.
+
Database backend API
--------------------