Code

Ticket #2052: thread_stuff.diff

File thread_stuff.diff, 1.4 KB (added by scott@…, 8 years ago)

alterations to django/db/transaction.py, django/utils/autoreload.py, django/utils/_threading_local.py

Line 
1Index: django/db/transaction.py
2===================================================================
3--- django/db/transaction.py    (revision 2865)
4+++ django/db/transaction.py    (working copy)
5@@ -12,7 +12,11 @@
6 or implicit commits or rollbacks.
7 """
8 
9-import thread
10+try:
11+    import thread
12+except:
13+    import dummy_thread as thread
14+
15 from django.db import connection
16 from django.conf import settings
17 
18Index: django/utils/autoreload.py
19===================================================================
20--- django/utils/autoreload.py  (revision 2865)
21+++ django/utils/autoreload.py  (working copy)
22@@ -28,8 +28,13 @@
23 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26-import os, sys, thread, time
27+import os, sys, time
28 
29+try:
30+    import thread
31+except:
32+    import dummy_thread as thread
33+
34 RUN_RELOADER = True
35 
36 def reloader_thread():
37Index: django/utils/_threading_local.py
38===================================================================
39--- django/utils/_threading_local.py    (revision 2865)
40+++ django/utils/_threading_local.py    (working copy)
41@@ -234,4 +234,8 @@
42         return __del__
43     __del__ = __del__()
44 
45-from threading import currentThread, enumerate, RLock
46+try:
47+    from threading import currentThread, enumerate, RLock
48+except ImportError:
49+    from dummy_threading import currentThread, enumerate, RLock
50+