Refs #23919, #27778 -- Removed obsolete mentions of unicode.

This commit is contained in:
Vytis Banaitis 2017-01-20 23:04:05 +02:00 committed by Tim Graham
parent 888c1e9bfe
commit d1bab24e01
63 changed files with 201 additions and 251 deletions

View file

@ -762,7 +762,7 @@ You can override most of these -- see `overriding predefined model methods`_,
below -- but there are a couple that you'll almost always want to define:
:meth:`~Model.__str__`
A Python "magic method" that returns a unicode "representation" of any
A Python "magic method" that returns a string representation of any
object. This is what Python and Django will use whenever a model
instance needs to be coerced and displayed as a plain string. Most
notably, this happens when you display an object in an interactive

View file

@ -472,11 +472,6 @@ Setup
of local time. This shields you from subtle and unreproducible bugs around
Daylight Saving Time (DST) transitions.
In this regard, time zones are comparable to ``unicode`` in Python. At first
it's hard. You get encoding and decoding errors. Then you learn the rules.
And some problems disappear -- you never get mangled output again when your
application receives non-ASCII input.
When you enable time zone support, you'll encounter some errors because
you're using naive datetimes where Django expects aware datetimes. Such
errors show up when running tests and they're easy to fix. You'll quickly

View file

@ -57,12 +57,9 @@ as a shorter alias, ``_``, to save typing.
global namespace, as an alias for ``gettext()``. In Django, we have chosen
not to follow this practice, for a couple of reasons:
1. For international character set (Unicode) support,
:func:`~django.utils.translation.ugettext` is more useful than
``gettext()``. Sometimes, you should be using
:func:`~django.utils.translation.ugettext_lazy` as the default
translation method for a particular file. Without ``_()`` in the
global namespace, the developer has to think about which is the
1. Sometimes, you should use :func:`~django.utils.translation.ugettext_lazy`
as the default translation method for a particular file. Without ``_()``
in the global namespace, the developer has to think about which is the
most appropriate translation function.
2. The underscore character (``_``) is used to represent "the previous
@ -418,7 +415,7 @@ Working with lazy translation objects
-------------------------------------
The result of a ``ugettext_lazy()`` call can be used wherever you would use a
unicode string (a :class:`str` object) in other Django code, but it may not
string (a :class:`str` object) in other Django code, but it may not
work with arbitrary Python code. For example, the following won't work because
the `requests <https://pypi.python.org/pypi/requests/>`_ library doesn't handle
``ugettext_lazy`` objects::
@ -434,14 +431,14 @@ strings before passing them to non-Django code::
If you try to use a ``ugettext_lazy()`` result where a bytestring (a
:class:`bytes` object) is expected, things won't work as expected since a
``ugettext_lazy()`` object doesn't know how to convert itself to a bytestring.
You can't use a unicode string inside a bytestring, either, so this is
consistent with normal Python behavior. For example, putting a unicode proxy
into a unicode string is fine::
You can't use a string inside a bytestring, either, so this is consistent with
normal Python behavior. For example, putting a string proxy into a string is
fine::
"Hello %s" % ugettext_lazy("people")
But you can't insert a unicode object into a bytestring and nor can you insert
a unicode proxy there::
But you can't insert a string into a bytestring and nor can you insert
a string proxy there::
b"Hello %s" % ugettext_lazy("people")

View file

@ -653,7 +653,7 @@ for basic values, and doesn't specify import paths).
Django can serialize the following:
- ``int``, ``float``, ``bool``, ``str``, ``unicode``, ``bytes``, ``None``
- ``int``, ``float``, ``bool``, ``str``, ``bytes``, ``None``
- ``list``, ``set``, ``tuple``, ``dict``
- ``datetime.date``, ``datetime.time``, and ``datetime.datetime`` instances
(include those that are timezone-aware)