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

Fix several issues for Django 1.6

master
Costas Basdekis пре 12 година
родитељ
комит
7b7e436472

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

@@ -1,5 +1,8 @@
1 1
 language: python
2 2
 python:
3
+  - 2.6
4
+  - 2.7
5
+install:
3 6
 - '2.6'
4 7
 - '2.7'
5 8
 env:
@@ -7,10 +10,11 @@ env:
7 10
     # $TRANSIFEX_PASSWORD for oscar_bot (used in transifex.sh)
8 11
     secure: FuIlzEsGJiAwhaIRBmRNsq9eXmuzs25fX6BChknW4lDyVAySWMp0+Zps9Bd0JgfFYUG3Ip+OTmksYIoTUsG25ZJS9cq1IFt3QKUAN70YCI/4ZBLeIdICPEyxq+Km179+NeEXmBUug17RLMLxh3MWfO+RKUHK9yHIPNNpq0dNyoo=
9 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 16
 install:
13
-- easy_install Django==$DJANGO_VERSION
17
+- easy_install $DJANGO_VERSION
14 18
 script:
15 19
 - make travis
16 20
 after_success:

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

@@ -22,6 +22,13 @@ class Shop(Application):
22 22
     offer_app = get_class('offer.app', 'application')
23 23
 
24 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 32
         urlpatterns = patterns('',
26 33
             (r'^i18n/', include('django.conf.urls.i18n')),
27 34
             (r'^catalogue/', include(self.catalogue_app.urls)),
@@ -44,7 +51,7 @@ class Shop(Application):
44 51
                 login_forbidden(auth_views.password_reset_done),
45 52
                 name='password-reset-done'),
46 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 55
                 {'post_reset_redirect': reverse_lazy('password-reset-complete')},
49 56
                 name='password-reset-confirm'),
50 57
             url(r'^password-reset/complete/$',

+ 1
- 1
oscar/apps/basket/views.py Прегледај датотеку

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

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

@@ -844,7 +844,7 @@ class AbstractProductAttributeValue(models.Model):
844 844
     value_text = models.CharField(
845 845
         _('Text'), max_length=255, blank=True, null=True)
846 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 848
     value_float = models.FloatField(_('Float'), blank=True, null=True)
849 849
     value_richtext = models.TextField(_('Richtext'), blank=True, null=True)
850 850
     value_date = models.DateField(_('Date'), blank=True, null=True)

+ 3
- 1
oscar/apps/customer/forms.py Прегледај датотеку

@@ -51,7 +51,9 @@ class PasswordResetForm(auth_forms.PasswordResetForm):
51 51
         site = get_current_site(request)
52 52
         if domain_override is not None:
53 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 57
             # Build reset url
56 58
             reset_url = "%s://%s%s" % (
57 59
                 'https' if use_https else 'http',

+ 1
- 0
oscar/forms/fields.py Прегледај датотеку

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

+ 2
- 2
requirements.txt Прегледај датотеку

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

+ 5
- 0
sites/sandbox/settings.py Прегледај датотеку

@@ -426,6 +426,11 @@ THUMBNAIL_KEY_PREFIX = 'oscar-sandbox'
426 426
 # Use a custom KV store to handle integrity error
427 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 435
 # Try and import local settings which can be used to override any of the above.
431 436
 try:

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

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

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

@@ -4,7 +4,7 @@
4 4
 # and then run "tox" from this directory.
5 5
 
6 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 9
 [testenv]
10 10
 commands = python runtests.py []
@@ -28,3 +28,13 @@ deps = -r{toxinidir}/requirements.txt
28 28
 basepython = python2.7
29 29
 deps = -r{toxinidir}/requirements.txt
30 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…
Откажи
Сачувај