diff --git a/.travis.yml b/.travis.yml index 5988dc2..af7e5ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: python sudo: false -python: 2.7 +python: 3.6 env: matrix: - DJANGO='django~=1.8.0' diff --git a/djcroco/fields.py b/djcroco/fields.py index 075e6ec..6266148 100644 --- a/djcroco/fields.py +++ b/djcroco/fields.py @@ -95,8 +95,7 @@ def __str__(self): return "%s" % self.attrs['name'] -class CrocoField(models.Field): - __metaclass__ = models.SubfieldBase +class CrocoField(models.Field, metaclass=models.SubfieldBase): description = _("CrocoField") def __init__(self, verbose_name=None, name=None, *args, **kwargs): diff --git a/djcroco/templatetags/croco_tags.py b/djcroco/templatetags/croco_tags.py index 5945ac6..5d63c1f 100644 --- a/djcroco/templatetags/croco_tags.py +++ b/djcroco/templatetags/croco_tags.py @@ -1,5 +1,4 @@ -import urllib -import urlparse +from urllib.parse import urlencode, urlparse, urlunparse from django import template @@ -19,12 +18,12 @@ def add_query_params(url, params=None): if not params: return url - encoded = urllib.urlencode(params) - url = urlparse.urlparse(url) + encoded = urlencode(params) + url = urlparse(url) if url.query: encoded = url.query + '&' + encoded - return urlparse.urlunparse(( + return urlunparse(( url.scheme, url.netloc, url.path, diff --git a/djcroco/tests/tests.py b/djcroco/tests/tests.py index c512266..c74db51 100644 --- a/djcroco/tests/tests.py +++ b/djcroco/tests/tests.py @@ -30,7 +30,7 @@ def render(self, tmpl): def assertContains(self, test_value, expected_set): # That assert method does not exist in Py2.6 msg = "%s does not contain %s" % (test_value, expected_set) - self.assert_(test_value not in expected_set, msg) + self.assertTrue(test_value not in expected_set, msg) def test_document_empty(self): # Ensure document can be empty @@ -49,7 +49,7 @@ def test_document_name(self): def test_document_size(self): # Ensure correct size self.assertEqual(self.instance.document.size, 679) - self.assertEqual(self.instance.document.size_human, u'679\xa0bytes') + self.assertEqual(self.instance.document.size_human, '679\xa0bytes') def test_document_type(self): # Ensure correct file type