Browse Source

Fix several issues for Django 1.6

master
Costas Basdekis 12 years ago
parent
commit
7b7e436472

+ 7
- 3
.travis.yml View File

1
 language: python
1
 language: python
2
 python:
2
 python:
3
+  - 2.6
4
+  - 2.7
5
+install:
3
 - '2.6'
6
 - '2.6'
4
 - '2.7'
7
 - '2.7'
5
 env:
8
 env:
7
     # $TRANSIFEX_PASSWORD for oscar_bot (used in transifex.sh)
10
     # $TRANSIFEX_PASSWORD for oscar_bot (used in transifex.sh)
8
     secure: FuIlzEsGJiAwhaIRBmRNsq9eXmuzs25fX6BChknW4lDyVAySWMp0+Zps9Bd0JgfFYUG3Ip+OTmksYIoTUsG25ZJS9cq1IFt3QKUAN70YCI/4ZBLeIdICPEyxq+Km179+NeEXmBUug17RLMLxh3MWfO+RKUHK9yHIPNNpq0dNyoo=
11
     secure: FuIlzEsGJiAwhaIRBmRNsq9eXmuzs25fX6BChknW4lDyVAySWMp0+Zps9Bd0JgfFYUG3Ip+OTmksYIoTUsG25ZJS9cq1IFt3QKUAN70YCI/4ZBLeIdICPEyxq+Km179+NeEXmBUug17RLMLxh3MWfO+RKUHK9yHIPNNpq0dNyoo=
9
   matrix:
12
   matrix:
10
-  - DJANGO_VERSION=1.4.8
11
-  - DJANGO_VERSION=1.5.4
13
+  - DJANGO_VERSION=Django==1.4.8
14
+  - DJANGO_VERSION=Django==1.5.4
15
+  - DJANGO_VERSION=http://github.com/django/django/tarball/stable/1.6.x
12
 install:
16
 install:
13
-- easy_install Django==$DJANGO_VERSION
17
+- easy_install $DJANGO_VERSION
14
 script:
18
 script:
15
 - make travis
19
 - make travis
16
 after_success:
20
 after_success:

+ 8
- 1
oscar/app.py View File

22
     offer_app = get_class('offer.app', 'application')
22
     offer_app = get_class('offer.app', 'application')
23
 
23
 
24
     def get_urls(self):
24
     def get_urls(self):
25
+        #After we drop support for Django<1.6 the following line won't be
26
+        #necessary, and the parameter uidb36 should be replaced with uidb64.
27
+        #The necessary update should also be done in oscar/apps/customer/utils.py
28
+        password_reset_confirm = getattr(auth_views,
29
+                                         'password_reset_confirm_uidb36',
30
+                                         auth_views.password_reset_confirm)
31
+
25
         urlpatterns = patterns('',
32
         urlpatterns = patterns('',
26
             (r'^i18n/', include('django.conf.urls.i18n')),
33
             (r'^i18n/', include('django.conf.urls.i18n')),
27
             (r'^catalogue/', include(self.catalogue_app.urls)),
34
             (r'^catalogue/', include(self.catalogue_app.urls)),
44
                 login_forbidden(auth_views.password_reset_done),
51
                 login_forbidden(auth_views.password_reset_done),
45
                 name='password-reset-done'),
52
                 name='password-reset-done'),
46
             url(r'^password-reset/confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
53
             url(r'^password-reset/confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
47
-                login_forbidden(auth_views.password_reset_confirm),
54
+                login_forbidden(password_reset_confirm),
48
                 {'post_reset_redirect': reverse_lazy('password-reset-complete')},
55
                 {'post_reset_redirect': reverse_lazy('password-reset-complete')},
49
                 name='password-reset-confirm'),
56
                 name='password-reset-confirm'),
50
             url(r'^password-reset/complete/$',
57
             url(r'^password-reset/complete/$',

+ 1
- 1
oscar/apps/basket/views.py View File

1
 from urlparse import urlparse
1
 from urlparse import urlparse
2
+import json
2
 
3
 
3
 from django.contrib import messages
4
 from django.contrib import messages
4
 from django.template.loader import render_to_string
5
 from django.template.loader import render_to_string
5
 from django.template import RequestContext
6
 from django.template import RequestContext
6
 from django.core.urlresolvers import reverse, resolve
7
 from django.core.urlresolvers import reverse, resolve
7
-from django.utils import simplejson as json
8
 from django.db.models import get_model
8
 from django.db.models import get_model
9
 from django.http import HttpResponseRedirect, Http404, HttpResponse
9
 from django.http import HttpResponseRedirect, Http404, HttpResponse
10
 from django.views.generic import FormView, View
10
 from django.views.generic import FormView, View

+ 1
- 1
oscar/apps/catalogue/abstract_models.py View File

844
     value_text = models.CharField(
844
     value_text = models.CharField(
845
         _('Text'), max_length=255, blank=True, null=True)
845
         _('Text'), max_length=255, blank=True, null=True)
846
     value_integer = models.IntegerField(_('Integer'), blank=True, null=True)
846
     value_integer = models.IntegerField(_('Integer'), blank=True, null=True)
847
-    value_boolean = models.BooleanField(_('Boolean'), blank=True)
847
+    value_boolean = models.NullBooleanField(_('Boolean'), blank=True)
848
     value_float = models.FloatField(_('Float'), blank=True, null=True)
848
     value_float = models.FloatField(_('Float'), blank=True, null=True)
849
     value_richtext = models.TextField(_('Richtext'), blank=True, null=True)
849
     value_richtext = models.TextField(_('Richtext'), blank=True, null=True)
850
     value_date = models.DateField(_('Date'), blank=True, null=True)
850
     value_date = models.DateField(_('Date'), blank=True, null=True)

+ 3
- 1
oscar/apps/customer/forms.py View File

51
         site = get_current_site(request)
51
         site = get_current_site(request)
52
         if domain_override is not None:
52
         if domain_override is not None:
53
             site.domain = site.name = domain_override
53
             site.domain = site.name = domain_override
54
-        for user in self.users_cache:
54
+        email = self.cleaned_data['email']
55
+        users = User._default_manager.filter(email__iexact=email)
56
+        for user in users:
55
             # Build reset url
57
             # Build reset url
56
             reset_url = "%s://%s%s" % (
58
             reset_url = "%s://%s%s" % (
57
                 'https' if use_https else 'http',
59
                 'https' if use_https else 'http',

+ 1
- 0
oscar/forms/fields.py View File

8
     Custom field similar to URLField type field, however also accepting and
8
     Custom field similar to URLField type field, however also accepting and
9
     validating local relative URLs, ie. '/product/'
9
     validating local relative URLs, ie. '/product/'
10
     """
10
     """
11
+    default_validators = []
11
 
12
 
12
     def __init__(self, max_length=None, min_length=None, verify_exists=None,
13
     def __init__(self, max_length=None, min_length=None, verify_exists=None,
13
                  *args, **kwargs):
14
                  *args, **kwargs):

+ 2
- 2
requirements.txt View File

1
 # Development
1
 # Development
2
-django-debug-toolbar
2
+django-debug-toolbar<=0.9.1
3
 django-cache-panel
3
 django-cache-panel
4
 django-debug-toolbar-template-timings
4
 django-debug-toolbar-template-timings
5
 django-extensions>=1.2.0,<1.3.0
5
 django-extensions>=1.2.0,<1.3.0
18
 django-nose>=1.1,<1.2
18
 django-nose>=1.1,<1.2
19
 spec>=0.11.1,<0.12
19
 spec>=0.11.1,<0.12
20
 WebTest>=2.0,<2.1
20
 WebTest>=2.0,<2.1
21
-django-webtest>=1.5.7,<1.6
21
+django-webtest>=1.7,<1.8
22
 detox==0.9.2
22
 detox==0.9.2
23
 coveralls>=0.1.1,<0.2
23
 coveralls>=0.1.1,<0.2
24
 purl>=0.4
24
 purl>=0.4

+ 5
- 0
sites/sandbox/settings.py View File

426
 # Use a custom KV store to handle integrity error
426
 # Use a custom KV store to handle integrity error
427
 THUMBNAIL_KVSTORE = 'oscar.sorl_kvstore.ConcurrentKVStore'
427
 THUMBNAIL_KVSTORE = 'oscar.sorl_kvstore.ConcurrentKVStore'
428
 
428
 
429
+# Django has switched to JSON serializing for security reasons, but it does not
430
+# serialize Models. We should resolve this by extending the
431
+# django/core/serializers/json.Serializer to have the `dumps` function. Also
432
+# in tests/config.py
433
+SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'
429
 
434
 
430
 # Try and import local settings which can be used to override any of the above.
435
 # Try and import local settings which can be used to override any of the above.
431
 try:
436
 try:

+ 1
- 1
tests/config.py View File

71
             'SITE_ID': 1,
71
             'SITE_ID': 1,
72
             'APPEND_SLASH': True,
72
             'APPEND_SLASH': True,
73
             'DDF_DEFAULT_DATA_FIXTURE': 'tests.dynamic_fixtures.OscarDynamicDataFixtureClass',
73
             'DDF_DEFAULT_DATA_FIXTURE': 'tests.dynamic_fixtures.OscarDynamicDataFixtureClass',
74
-            
74
+            'SESSION_SERIALIZER': 'django.contrib.sessions.serializers.PickleSerializer',
75
         }
75
         }
76
         if django.VERSION >= (1, 5):
76
         if django.VERSION >= (1, 5):
77
             test_settings['INSTALLED_APPS'] += ['tests._site.myauth', ]
77
             test_settings['INSTALLED_APPS'] += ['tests._site.myauth', ]

+ 11
- 1
tox.ini View File

4
 # and then run "tox" from this directory.
4
 # and then run "tox" from this directory.
5
 
5
 
6
 [tox]
6
 [tox]
7
-envlist = py26-1.4, py27-1.4, py26-1.5, py27-1.5
7
+envlist = py26-1.4, py27-1.4, py26-1.5, py27-1.5, py26-1.6, py27-1.6
8
 
8
 
9
 [testenv]
9
 [testenv]
10
 commands = python runtests.py []
10
 commands = python runtests.py []
28
 basepython = python2.7
28
 basepython = python2.7
29
 deps = -r{toxinidir}/requirements.txt
29
 deps = -r{toxinidir}/requirements.txt
30
        django==1.5.4
30
        django==1.5.4
31
+
32
+[testenv:py26-1.6]
33
+basepython = python2.6
34
+deps = -r{toxinidir}/requirements.txt
35
+       https://www.djangoproject.com/download/1.6c1/tarball/
36
+
37
+[testenv:py27-1.6]
38
+basepython = python2.7
39
+deps = -r{toxinidir}/requirements.txt
40
+       https://www.djangoproject.com/download/1.6c1/tarball/

Loading…
Cancel
Save