summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-08-18 10:56:56 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-08-18 10:56:56 +0200
commit4c1286cf78d03fb7df03774f5f4beb9756ec29c0 (patch)
tree94442927de998d0706e8a554e0891d9802d74cba
parent527f967ec1e8d463d8f950549d7f5c9b4a4ffc7b (diff)
[py3] Added compatibility import of thread/_thread
This commit fixes the auto-reload of the development server. I should have done that change in ca07fda2.
-rw-r--r--django/db/backends/__init__.py2
-rw-r--r--django/utils/autoreload.py2
-rw-r--r--django/utils/six.py2
-rw-r--r--docs/topics/python3.txt4
4 files changed, 6 insertions, 4 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index c7682a546b..023a4faba0 100644
--- a/django/db/backends/__init__.py
+++ b/django/db/backends/__init__.py
@@ -1,7 +1,7 @@
from django.db.utils import DatabaseError
try:
- import thread
+ from django.utils.six.moves import _thread as thread
except ImportError:
from django.utils.six.moves import _dummy_thread as thread
from contextlib import contextmanager
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 9032cd024d..2daafedd85 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -31,7 +31,7 @@
import os, sys, time, signal
try:
- import thread
+ from django.utils.six.moves import _thread as thread
except ImportError:
from django.utils.six.moves import _dummy_thread as thread
diff --git a/django/utils/six.py b/django/utils/six.py
index ceb5d70e58..767fe0bbe9 100644
--- a/django/utils/six.py
+++ b/django/utils/six.py
@@ -365,4 +365,6 @@ def iterlists(d):
"""Return an iterator over the values of a MultiValueDict."""
return getattr(d, _iterlists)()
+
add_move(MovedModule("_dummy_thread", "dummy_thread"))
+add_move(MovedModule("_thread", "thread"))
diff --git a/docs/topics/python3.txt b/docs/topics/python3.txt
index 742731e1a7..32463f2e51 100644
--- a/docs/topics/python3.txt
+++ b/docs/topics/python3.txt
@@ -122,8 +122,8 @@ Moved modules
Some modules were renamed in Python 3. The :mod:`django.utils.six.moves
<six.moves>` module provides a compatible location to import them.
-In addition to six' defaults, Django's version provides ``dummy_thread`` as
-``_dummy_thread``.
+In addition to six' defaults, Django's version provides ``thread`` as
+``_thread`` and ``dummy_thread`` as ``_dummy_thread``.
PY3
---