Skip to content

Commit

Permalink
v0.4-caktus: Python 3.8 Django 2.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kmtracey committed Nov 3, 2020
2 parents f191d2d + 84db6b0 commit 8d2a26b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
3 changes: 3 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
django>=2.2.16,<3.0
URLObject
django-appconf
docutils
model_mommy
django-ttag>=2.3
Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,11 @@ def find_version(*file_paths):
"Development Status :: 4 - Beta",
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.8',
'Topic :: Utilities',
],
install_requires=[
Expand Down
2 changes: 1 addition & 1 deletion sorter/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3-caktus"
__version__ = "0.4-caktus"
6 changes: 2 additions & 4 deletions sorter/templatetags/sorter_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def clean_with(self, value):
"""
Cleans the given name of the sort query
"""
if not isinstance(value, basestring):
if not isinstance(value, str):
raise TemplateSyntaxError("Value '%s' is not a string" % value)
# in case the value equals the default query name
# or it already has the default query name prefixed
Expand Down Expand Up @@ -90,7 +90,7 @@ class TemplateAsTagMetaclass(ttag.helpers.as_tag.AsTagMetaclass):
options_class = TemplateAsTagOptions


class SortURL(SorterAsTag):
class SortURL(SorterAsTag, metaclass=TemplateAsTagMetaclass):
"""
Parses a tag that's supposed to be in this format:
Expand All @@ -99,8 +99,6 @@ class SortURL(SorterAsTag):
{% sorturl with "objects" by "creation_date,-title" %}
"""
__metaclass__ = TemplateAsTagMetaclass

with_ = ttag.Arg(required=False, named=True, default=settings.SORTER_DEFAULT_QUERY_NAME)
rel = ttag.Arg(required=False, named=True)
class_ = ttag.Arg(required=False, named=True)
Expand Down
8 changes: 8 additions & 0 deletions sorter/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,24 @@
'django.contrib.sites',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.messages',
'sorter',
]

MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
]

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'OPTIONS': {
'context_processors': (
"django.contrib.auth.context_processors.auth",
'django.contrib.messages.context_processors.messages'
),
'builtins': [
'sorter.templatetags.sorter_tags',
Expand Down
6 changes: 3 additions & 3 deletions sorter/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from itertools import tee, izip, chain
from itertools import tee, chain


def cycle_pairs(iterable):
Expand All @@ -9,5 +9,5 @@ def cycle_pairs(iterable):
"""
first, last = iterable[0], iterable[-1]
a, b = tee(iterable)
iter(b).next()
return chain(izip(a, b), [(last, first)])
next(iter(b))
return chain(zip(a, b), [(last, first)])

0 comments on commit 8d2a26b

Please sign in to comment.