Просмотр исходного кода

Fix warning from bytestrings being slugified

master
David Winterbottom 13 лет назад
Родитель
Сommit
f80cb5e9fa

+ 5
- 1
oscar/core/utils.py Просмотреть файл

@@ -3,4 +3,8 @@ from django.template import defaultfilters
3 3
 
4 4
 
5 5
 def slugify(value):
6
-    return defaultfilters.slugify(unidecode(value))
6
+    """
7
+    Slugify a string (even if it contains non-ASCII chars)
8
+    """
9
+    return defaultfilters.slugify(
10
+        unidecode(unicode(value)))

+ 1
- 1
tests/functional/catalogue/catalogue_tests.py Просмотреть файл

@@ -39,7 +39,7 @@ class TestProductListView(WebTestCase):
39 39
 
40 40
     def test_shows_pagination_navigation_for_multiple_pages(self):
41 41
         per_page = ProductListView.paginate_by
42
-        title = "Product #%d"
42
+        title = u"Product #%d"
43 43
         for idx in range(0, int(1.5 * per_page)):
44 44
             create_product(title=title % idx)
45 45
 

+ 1
- 0
tests/unit/catalogue_tests.py Просмотреть файл

@@ -1,4 +1,5 @@
1 1
 from django.test import TestCase
2
+from django.core.exceptions import ValidationError
2 3
 
3 4
 from oscar.apps.catalogue.models import (Product, ProductClass,
4 5
                                          ProductAttribute,

+ 2
- 2
tests/unit/offer/custom_range_tests.py Просмотреть файл

@@ -20,9 +20,9 @@ class TestACustomRange(TestCase):
20 20
         self.rng = custom.create_range(CustomRange)
21 21
 
22 22
     def test_correctly_includes_match(self):
23
-        test_product = create_product(title="A tale")
23
+        test_product = create_product(title=u"A tale")
24 24
         self.assertTrue(self.rng.contains_product(test_product))
25 25
 
26 26
     def test_correctly_excludes_nonmatch(self):
27
-        test_product = create_product(title="B tale")
27
+        test_product = create_product(title=u"B tale")
28 28
         self.assertFalse(self.rng.contains_product(test_product))

Загрузка…
Отмена
Сохранить