Skip to content

Commit

Permalink
[1.6.x] Fixed #20830 -- Clarified that Django uses a customized versi…
Browse files Browse the repository at this point in the history
…on of six.

Thanks glarrain for the suggestion.

Backport of a53caf2 from master
  • Loading branch information
dchetwynd authored and timgraham committed Sep 23, 2013
1 parent cdb5672 commit 5e549e7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions docs/topics/python3.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ to stay compatible with Python 2. But authors of pluggable applications are
encouraged to use the same porting strategy as Django itself. encouraged to use the same porting strategy as Django itself.


Writing compatible code is much easier if you target Python ≥ 2.6. 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 introduces compatibility tools such as :mod:`django.utils.six`, which is a
convenience, forwards-compatible aliases were introduced in Django 1.4.2. If customized version of the :mod:`six module <six>`. For convenience,
your application takes advantage of these tools, it will require Django ≥ forwards-compatible aliases were introduced in Django 1.4.2. If your
1.4.2. application takes advantage of these tools, it will require Django ≥ 1.4.2.


Obviously, writing compatible source code adds some overhead, and that can Obviously, writing compatible source code adds some overhead, and that can
cause frustration. Django's developers have found that attempting to write cause frustration. Django's developers have found that attempting to write
Expand Down Expand Up @@ -328,8 +328,8 @@ Writing compatible code with six
six_ is the canonical compatibility library for supporting Python 2 and 3 in six_ is the canonical compatibility library for supporting Python 2 and 3 in
a single codebase. Read its documentation! a single codebase. Read its documentation!


:mod:`six` is bundled with Django as of version 1.4.2. You can import it as A :mod:`customized version of six <django.utils.six>` is bundled with Django
:mod:`django.utils.six`. as of version 1.4.2. You can import it as ``django.utils.six``.


Here are the most common changes required to write compatible code. Here are the most common changes required to write compatible code.


Expand Down Expand Up @@ -364,8 +364,9 @@ Import ``six.moves.xrange`` wherever you use ``xrange``.
Moved modules Moved modules
~~~~~~~~~~~~~ ~~~~~~~~~~~~~


Some modules were renamed in Python 3. The :mod:`django.utils.six.moves Some modules were renamed in Python 3. The ``django.utils.six.moves``
<six.moves>` module provides a compatible location to import them. module (based on the :mod:`Python six.moves module <six.moves>`) provides a
compatible location to import them.


PY2 PY2
~~~ ~~~
Expand All @@ -380,10 +381,11 @@ function.


.. module:: django.utils.six .. module:: django.utils.six


Customizations of six Django customized version of six
--------------------- --------------------------------


The version of six bundled with Django includes a few extras. The version of six bundled with Django (``django.utils.six``) includes a few
extras.


.. function:: assertRaisesRegex(testcase, *args, **kwargs) .. function:: assertRaisesRegex(testcase, *args, **kwargs)


Expand Down

0 comments on commit 5e549e7

Please sign in to comment.