summaryrefslogtreecommitdiff
path: root/docs/topics/python3.txt
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-09-07 11:57:46 -0400
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-09-07 11:57:46 -0400
commite1a37d55374a399dee9c302419fbe9badd92abb0 (patch)
treef4af094b07cd88705ebe7863731ad7278974e8eb /docs/topics/python3.txt
parentcceff73acd7d82904a4b9c28dea2448f09c941b0 (diff)
[py3] Documented forwards-compatible aliases
that will be available as of version 1.4.2.
Diffstat (limited to 'docs/topics/python3.txt')
-rw-r--r--docs/topics/python3.txt18
1 files changed, 13 insertions, 5 deletions
diff --git a/docs/topics/python3.txt b/docs/topics/python3.txt
index 457486caa4..d816db8046 100644
--- a/docs/topics/python3.txt
+++ b/docs/topics/python3.txt
@@ -25,10 +25,11 @@ free to chose another strategy for your own code, especially if you don't need
to stay compatible with Python 2. But authors of pluggable applications are
encouraged to use the same porting strategy as Django itself.
-Writing compatible code is much easier if you target Python ≥ 2.6. You will
-most likely take advantage of the compatibility functions introduced in Django
-1.5, like :mod:`django.utils.six`, so your application will also require
-Django ≥ 1.5.
+Writing compatible code is much easier if you target Python ≥ 2.6. Django 1.5
+introduces compatibility tools such as :mod:`django.utils.six`. For
+convenience, forwards-compatible aliases were introduced in Django 1.4.2. If
+your application takes advantage of these tools, it will require Django ≥
+1.4.2.
Obviously, writing compatible source code adds some overhead, and that can
cause frustration. Django's developers have found that attempting to write
@@ -102,6 +103,8 @@ Old name New name
For backwards compatibility, the old names still work on Python 2. Under
Python 3, ``smart_str`` is an alias for ``smart_text``.
+For forwards compatibility, the new names work as of Django 1.4.2.
+
.. note::
:mod:`django.utils.encoding` was deeply refactored in Django 1.5 to
@@ -126,6 +129,8 @@ For backwards compatibility, the old names still work on Python 2. Under
Python 3, ``EscapeString`` and ``SafeString`` are aliases for ``EscapeText``
and ``SafeText`` respectively.
+For forwards compatibility, the new names work as of Django 1.4.2.
+
:meth:`__str__` and :meth:`__unicode__` methods
-----------------------------------------------
@@ -166,6 +171,8 @@ On Python 3, the decorator is a no-op. On Python 2, it defines appropriate
This technique is the best match for Django's porting philosophy.
+For forwards compatibility, this decorator is available as of Django 1.4.2.
+
Finally, note that :meth:`__repr__` must return a :class:`str` on all versions
of Python.
@@ -317,7 +324,8 @@ Writing compatible code with six
six_ is the canonical compatibility library for supporting Python 2 and 3 in
a single codebase. Read its documentation!
-:mod:`six` is bundled with Django: you can import it as :mod:`django.utils.six`.
+:mod`six` is bundled with Django as of version 1.4.2. You can import it as
+:mod`django.utils.six`.
Here are the most common changes required to write compatible code.