Преглед изворни кода

Drop support for Django 1.5

Oscar's policy is to support two versions of Django. So while there
isn't a major reason to drop support for Django 1.5, dropping support
for Django 1.6 once 1.8 is released will reduce complexity considerably.
master
Maik Hoepfel пре 11 година
родитељ
комит
d131cfc15a
7 измењених фајлова са 26 додато и 58 уклоњено
  1. 1
    2
      .travis.yml
  2. 2
    1
      docs/source/releases/v0.8.rst
  3. 12
    22
      oscar/app.py
  4. 0
    4
      oscar/apps/catalogue/managers.py
  5. 6
    9
      oscar/apps/customer/utils.py
  6. 1
    1
      setup.py
  7. 4
    19
      tox.ini

+ 1
- 2
.travis.yml Прегледај датотеку

@@ -10,9 +10,8 @@ env:
10 10
     # $TRANSIFEX_PASSWORD for oscar_bot (used in transifex.sh)
11 11
     secure: FuIlzEsGJiAwhaIRBmRNsq9eXmuzs25fX6BChknW4lDyVAySWMp0+Zps9Bd0JgfFYUG3Ip+OTmksYIoTUsG25ZJS9cq1IFt3QKUAN70YCI/4ZBLeIdICPEyxq+Km179+NeEXmBUug17RLMLxh3MWfO+RKUHK9yHIPNNpq0dNyoo=
12 12
   matrix:
13
-    - DJANGO_VERSION=1.5.8
14 13
     - DJANGO_VERSION=1.6.5
15
-    - DJANGO_VERSION=https://www.djangoproject.com/download/1.7c1/tarball/
14
+    - DJANGO_VERSION=https://github.com/django/django/archive/2c6ef625ad73c38769f086733356e37a938b69c3.zip
16 15
 
17 16
 matrix:
18 17
   allow_failures:

+ 2
- 1
docs/source/releases/v0.8.rst Прегледај датотеку

@@ -37,7 +37,8 @@ availability logic now needs to be handled with strategies.
37 37
 Compatibility
38 38
 -------------
39 39
 
40
-Oscar 0.8 is compatible with Django 1.5-1.7. 
40
+Oscar 0.8 drops supports for Django 1.5, and is compatible with Django 1.6 and
41
+Django 1.7.
41 42
 
42 43
 Support for Python 2.6 has been dropped; Oscar works with Python 2.7, 3.3
43 44
 and 3.4.

+ 12
- 22
oscar/app.py Прегледај датотеку

@@ -48,37 +48,27 @@ class Shop(Application):
48 48
                 login_forbidden(auth_views.password_reset_done),
49 49
                 name='password-reset-done')]
50 50
 
51
-        # Django <=1.5: uses uidb36 to encode the user's primary key
51
+        # Django <=1.5: uses uidb36 to encode the user's primary key (support has been removed)
52 52
         # Django 1.6:   uses uidb64 to encode the user's primary key, but
53 53
         #               but supports legacy links
54 54
         # Django > 1.7: used uidb64 to encode the user's primary key
55 55
         # see https://docs.djangoproject.com/en/dev/releases/1.6/#django-contrib-auth-password-reset-uses-base-64-encoding-of-user-pk
56
-        if django.VERSION < (1, 6):
56
+        urls.append(
57
+            url(r'^password-reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
58
+                login_forbidden(auth_views.password_reset_confirm),
59
+                {
60
+                    'post_reset_redirect': reverse_lazy('password-reset-complete'),
61
+                    'set_password_form': self.set_password_form,
62
+                },
63
+                name='password-reset-confirm'))
64
+        if django.VERSION < (1, 7):
57 65
             urls.append(
58 66
                 url(r'^password-reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
59
-                    login_forbidden(auth_views.password_reset_confirm),
67
+                    login_forbidden(auth_views.password_reset_confirm_uidb36),
60 68
                     {
61 69
                         'post_reset_redirect': reverse_lazy('password-reset-complete'),
62 70
                         'set_password_form': self.set_password_form,
63
-                    },
64
-                    name='password-reset-confirm'))
65
-        else:
66
-            urls.append(
67
-                url(r'^password-reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
68
-                    login_forbidden(auth_views.password_reset_confirm),
69
-                    {
70
-                        'post_reset_redirect': reverse_lazy('password-reset-complete'),
71
-                        'set_password_form': self.set_password_form,
72
-                    },
73
-                    name='password-reset-confirm'))
74
-            if django.VERSION < (1, 7):
75
-                urls.append(
76
-                    url(r'^password-reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
77
-                        login_forbidden(auth_views.password_reset_confirm_uidb36),
78
-                        {
79
-                            'post_reset_redirect': reverse_lazy('password-reset-complete'),
80
-                            'set_password_form': self.set_password_form,
81
-                        }))
71
+                    }))
82 72
 
83 73
         urls += [
84 74
             url(r'^password-reset/complete/$',

+ 0
- 4
oscar/apps/catalogue/managers.py Прегледај датотеку

@@ -40,8 +40,6 @@ class ProductManager(models.Manager):
40 40
     def base_queryset(self):
41 41
         return self.get_queryset().base_queryset()
42 42
 
43
-    get_query_set = get_queryset  # Django 1.5 compatibility fix
44
-
45 43
 
46 44
 class BrowsableProductManager(ProductManager):
47 45
     """
@@ -52,5 +50,3 @@ class BrowsableProductManager(ProductManager):
52 50
 
53 51
     def get_queryset(self):
54 52
         return super(BrowsableProductManager, self).get_queryset().browsable()
55
-
56
-    get_query_set = get_queryset  # Django 1.5 compatibility fix

+ 6
- 9
oscar/apps/customer/utils.py Прегледај датотеку

@@ -1,10 +1,11 @@
1 1
 import logging
2 2
 
3
-import django
4 3
 from django.core.mail import EmailMessage, EmailMultiAlternatives
5 4
 from django.core.urlresolvers import reverse
6 5
 from django.conf import settings
7 6
 from django.contrib.auth.tokens import default_token_generator
7
+from django.utils.http import urlsafe_base64_encode
8
+from django.utils.encoding import force_bytes
8 9
 
9 10
 from oscar.core.loading import get_model
10 11
 
@@ -111,14 +112,10 @@ def get_password_reset_url(user, token_generator=default_token_generator):
111 112
     """
112 113
     Generate a password-reset URL for a given user
113 114
     """
114
-    kwargs = {'token': token_generator.make_token(user)}
115
-    if django.VERSION < (1, 6):
116
-        from django.utils.http import int_to_base36
117
-        kwargs['uidb36'] = int_to_base36(user.id)
118
-    else:
119
-        from django.utils.http import urlsafe_base64_encode
120
-        from django.utils.encoding import force_bytes
121
-        kwargs['uidb64'] = urlsafe_base64_encode(force_bytes(user.id))
115
+    kwargs = {
116
+        'token': token_generator.make_token(user),
117
+        'uidb64': urlsafe_base64_encode(force_bytes(user.id)),
118
+    }
122 119
     return reverse('password-reset-confirm', kwargs=kwargs)
123 120
 
124 121
 

+ 1
- 1
setup.py Прегледај датотеку

@@ -35,7 +35,7 @@ setup(name='django-oscar',
35 35
       packages=find_packages(exclude=["sandbox*", "tests*"]),
36 36
       include_package_data=True,
37 37
       install_requires=[
38
-          'django>=1.5.7,<1.8',
38
+          'django>=1.6.5,<1.8',
39 39
           # PIL is required for image fields, Pillow is the "friendly" PIL fork
40 40
           'pillow>=1.7.8,<2.5',
41 41
           # Oscar ships with migrations

+ 4
- 19
tox.ini Прегледај датотеку

@@ -8,26 +8,11 @@ exclude = migrations
8 8
 max-complexity = 10
9 9
 
10 10
 [tox]
11
-envlist = py27-1.5, py27-1.6, py33-1.5, py33-1.6, py34-1.5, py34-1.6
11
+envlist = py27-1.6, py27-1.7, py33-1.6, py33-1.7, py34-1.6, py34-1.7
12 12
 
13 13
 [testenv]
14 14
 commands = python runtests.py []
15 15
 
16
-[testenv:py27-1.5]
17
-basepython = python2.7
18
-deps = -r{toxinidir}/requirements_py2.txt
19
-       django==1.5.8
20
-
21
-[testenv:py33-1.5]
22
-basepython = python3.3
23
-deps = -r{toxinidir}/requirements.txt
24
-       django==1.5.8
25
-
26
-[testenv:py34-1.5]
27
-basepython = python3.4
28
-deps = -r{toxinidir}/requirements.txt
29
-       django==1.5.8
30
-
31 16
 [testenv:py27-1.6]
32 17
 basepython = python2.7
33 18
 deps = -r{toxinidir}/requirements_py2.txt
@@ -46,14 +31,14 @@ deps = -r{toxinidir}/requirements.txt
46 31
 [testenv:py27-1.7]
47 32
 basepython = python2.7
48 33
 deps = -r{toxinidir}/requirements_py2.txt
49
-       https://www.djangoproject.com/download/1.7c1/tarball/
34
+       https://github.com/django/django/archive/2c6ef625ad73c38769f086733356e37a938b69c3.zip
50 35
 
51 36
 [testenv:py33-1.7]
52 37
 basepython = python3.3
53 38
 deps = -r{toxinidir}/requirements.txt
54
-       https://www.djangoproject.com/download/1.7c1/tarball/
39
+       https://github.com/django/django/archive/2c6ef625ad73c38769f086733356e37a938b69c3.zip
55 40
 
56 41
 [testenv:py34-1.7]
57 42
 basepython = python3.4
58 43
 deps = -r{toxinidir}/requirements.txt
59
-       https://www.djangoproject.com/download/1.7c1/tarball/
44
+       https://github.com/django/django/archive/2c6ef625ad73c38769f086733356e37a938b69c3.zip

Loading…
Откажи
Сачувај