Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.1:ARM:Staging
python-django-classy-tags
django2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File django2.patch of Package python-django-classy-tags
From 77d6ebc6fe4744b3fdb0965d2342143319d2cec5 Mon Sep 17 00:00:00 2001 From: Tim Graham <timograham@gmail.com> Date: Tue, 28 Aug 2018 14:52:47 -0400 Subject: [PATCH 2/6] dropped support for Django < 1.11 --- classytags/models.py | 0 classytags/test/context_managers.py | 9 ++------ classytags/test/project/models.py | 0 classytags/tests.py | 36 +++++++---------------------- classytags/utils.py | 8 +------ docs/installation.rst | 8 +++---- runtests.py | 22 ++++-------------- setup.py | 6 ++--- 9 files changed, 20 insertions(+), 104 deletions(-) delete mode 100644 classytags/models.py delete mode 100644 classytags/test/project/models.py diff --git a/classytags/models.py b/classytags/models.py deleted file mode 100644 index e69de29..0000000 diff --git a/classytags/test/context_managers.py b/classytags/test/context_managers.py index 71f5c44..e3a5b0a 100644 --- a/classytags/test/context_managers.py +++ b/classytags/test/context_managers.py @@ -1,14 +1,9 @@ # -*- coding: utf-8 -*- from django import template from django.conf import settings +from django.template.engine import Engine - -try: - Engine = None - builtins = template.base.builtins -except AttributeError: - from django.template.engine import Engine - builtins = Engine.get_default().template_builtins +builtins = Engine.get_default().template_builtins class NULL: diff --git a/classytags/test/project/models.py b/classytags/test/project/models.py deleted file mode 100644 index e69de29..0000000 diff --git a/classytags/tests.py b/classytags/tests.py index a496610..8ac90f9 100644 --- a/classytags/tests.py +++ b/classytags/tests.py @@ -3,11 +3,9 @@ import os import sys import warnings -from distutils.version import LooseVersion import operator from unittest import TestCase -import django from django import template from django.core.exceptions import ImproperlyConfigured from django.template import Context, RequestContext @@ -26,13 +24,6 @@ from classytags.test.context_managers import SettingsOverride from classytags.test.context_managers import TemplateTags -DJANGO_1_4_OR_HIGHER = ( - LooseVersion(django.get_version()) >= LooseVersion('1.4') -) -DJANGO_1_5_OR_HIGHER = ( - LooseVersion(django.get_version()) >= LooseVersion('1.5') -) - CLASSY_TAGS_DIR = os.path.abspath(os.path.dirname(__file__)) @@ -835,21 +826,16 @@ class Fail4(helpers.AsTag): arguments.Argument('varname', resolve=False), ) - if DJANGO_1_4_OR_HIGHER: - exc_class = NotImplementedError - else: # pragma: no cover - exc_class = template.TemplateSyntaxError - with TemplateTags(Fail, Fail2, Fail3, Fail4): context = template.Context({}) tpl = template.Template("{% fail %}") - self.assertRaises(exc_class, tpl.render, context) + self.assertRaises(NotImplementedError, tpl.render, context) self.assertRaises(ImproperlyConfigured, template.Template, "{% fail2 %}") self.assertRaises(ImproperlyConfigured, template.Template, "{% fail3 %}") tpl = template.Template("{% fail4 as something %}") - self.assertRaises(exc_class, tpl.render, context) + self.assertRaises(NotImplementedError, tpl.render, context) def test_too_many_arguments(self): class NoArg(core.Tag): @@ -1470,13 +1456,10 @@ def test_flatten_context(self): expected = { 'foo': 'test', 'bar': 'baz', + 'None': None, + 'True': True, + 'False': False, } - if DJANGO_1_5_OR_HIGHER: - expected.update({ - 'None': None, - 'True': True, - 'False': False, - }) self.assertEqual(flat, expected) context.flatten = None flat = utils.flatten_context(context) @@ -1491,13 +1474,10 @@ def test_flatten_requestcontext(self): 'foo': 'test', 'request': 'bar', 'bar': 'baz', + 'None': None, + 'True': True, + 'False': False, } - if DJANGO_1_5_OR_HIGHER: - expected.update({ - 'None': None, - 'True': True, - 'False': False, - }) checked_keys = expected.keys() diff --git a/classytags/utils.py b/classytags/utils.py index 6b2a444..02b18e9 100644 --- a/classytags/utils.py +++ b/classytags/utils.py @@ -1,16 +1,10 @@ import re from copy import copy -from distutils.version import LooseVersion from classytags.compat import compat_basestring -from django import get_version from django.template import Context, RequestContext from django.template.context import BaseContext -DJANGO_1_9_OR_HIGHER = ( - LooseVersion(get_version()) >= LooseVersion('1.9') -) - class NULL: """ @@ -102,7 +96,7 @@ def do_flatten(context): flat.update(d) return flat - if callable(getattr(context, 'flatten', None)) and DJANGO_1_9_OR_HIGHER: + if callable(getattr(context, 'flatten', None)): return context.flatten() elif isinstance(context, BaseContext): return do_flatten(context) diff --git a/docs/installation.rst b/docs/installation.rst index 2a87088..1925084 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -5,11 +5,9 @@ Installation To install django-classy-tags, please use ``sudo pip install django-classy-tags``. -If you don't want to use ``pip``, download the latest version from +If you don't want to use ``pip``, download the latest version from `pypi <http://pypi.python.org/pypi/django-classy-tags>`_, unpack the tarball and run ``sudo python setup.py install``. -django-classy-tags has no dependencies other than Django. Django 1.3, 1.4, 1.5, -1.6, 1.7, 1.8, 1.9 and 1.10 are supportd. - -django-classy-tags supports Python 2.7, 3.3, 3.4 and 3.5. +django-classy-tags has no dependencies other than Django. Django 1.11 and +later are supported. diff --git a/runtests.py b/runtests.py index ff67c4f..3fccd80 100644 --- a/runtests.py +++ b/runtests.py @@ -2,12 +2,9 @@ import warnings import os import sys -from django import VERSION urlpatterns = [] -TEMPLATE_DEBUG = True - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -21,14 +18,7 @@ 'classytags.test.project', ] -TEMPLATE_DIRS = [ - os.path.join(os.path.dirname(__file__), 'test_templates'), -] - -if VERSION >= (1,6): - TEST_RUNNER = 'django.test.runner.DiscoverRunner' -else: - TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner' +TEST_RUNNER = 'django.test.runner.DiscoverRunner' ROOT_URLCONF = 'runtests' @@ -36,9 +26,9 @@ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True, - 'DIRS': TEMPLATE_DIRS, + 'DIRS': os.path.join(os.path.dirname(__file__), 'test_templates'), 'OPTIONS': { - 'debug': TEMPLATE_DEBUG, + 'debug': True, }, }, ] @@ -51,9 +41,6 @@ def main(): ROOT_URLCONF = ROOT_URLCONF, DATABASES = DATABASES, TEST_RUNNER = TEST_RUNNER, - TEMPLATE_DIRS = TEMPLATE_DIRS, - TEMPLATE_DEBUG = TEMPLATE_DEBUG, - MIDDLEWARE_CLASSES = [], TEMPLATES=TEMPLATES, ) @@ -63,8 +50,7 @@ def main(): test_runner = TestRunner(verbosity=1, interactive=False, failfast=False) warnings.simplefilter("ignore") - if django.VERSION >= (1, 7): - django.setup() + django.setup() failures = test_runner.run_tests(['classytags']) sys.exit(failures) diff --git a/setup.py b/setup.py index cb515c4..241d299 100644 --- a/setup.py +++ b/setup.py @@ -11,19 +11,17 @@ url = 'http://github.com/ojii/django-classy-tags', packages = find_packages(), zip_safe=False, - install_requires=[ - 'Django>1.3', - ], + install_requires=['Django>=1.11'], test_suite='runtests.main', classifiers=[ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD License", "Framework :: Django", + 'Framework :: Django :: 1.11', "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Utilities", From c8f4841ff21d217b3eabdb49c5e0d450951be0fd Mon Sep 17 00:00:00 2001 From: Tim Graham <timograham@gmail.com> Date: Tue, 28 Aug 2018 14:58:14 -0400 Subject: [PATCH 3/6] added testing for Django 2.0 and 2.1 --- setup.py | 2 ++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 241d299..d03e138 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,8 @@ "License :: OSI Approved :: BSD License", "Framework :: Django", 'Framework :: Django :: 1.11', + 'Framework :: Django :: 2.0', + 'Framework :: Django :: 2.1', "Intended Audience :: Developers", "Natural Language :: English", "Operating System :: OS Independent", From ed26ce1ec7c515413480e8db4658e53e52ac8d06 Mon Sep 17 00:00:00 2001 From: Tim Graham <timograham@gmail.com> Date: Tue, 28 Aug 2018 15:03:35 -0400 Subject: [PATCH 4/6] replaced classytags.compat with six --- classytags/compat.py | 13 ------------- classytags/core.py | 8 ++++---- classytags/tests.py | 4 ++-- classytags/utils.py | 4 ++-- classytags/values.py | 4 ++-- 5 files changed, 10 insertions(+), 23 deletions(-) delete mode 100644 classytags/compat.py diff --git a/classytags/compat.py b/classytags/compat.py deleted file mode 100644 index 074ce35..0000000 --- a/classytags/compat.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# flake8: noqa - -try: # pragma: no cover - compat_basestring = basestring -except NameError: - compat_basestring = str - -try: - compat_next = next -except NameError: # pragma: no cover - def compat_next(it): - return it.next() diff --git a/classytags/core.py b/classytags/core.py index 916930d..de0ffba 100644 --- a/classytags/core.py +++ b/classytags/core.py @@ -1,9 +1,9 @@ from operator import attrgetter from django.template import Node +from django.utils import six from classytags.blocks import BlockDefinition -from classytags.compat import compat_basestring from classytags.parser import Parser from classytags.utils import StructuredOptions from classytags.utils import get_default_name @@ -25,8 +25,8 @@ def __init__(self, *options, **kwargs): self.options[current_breakpoint] = [] self.all_argument_names = [] for value in options: - if isinstance(value, compat_basestring): - if isinstance(last, compat_basestring): + if isinstance(value, six.string_types): + if isinstance(last, six.string_types): self.combined_breakpoints[last] = value self.breakpoints.append(value) current_breakpoint = value @@ -39,7 +39,7 @@ def __init__(self, *options, **kwargs): for block in kwargs.get('blocks', []): if isinstance(block, BlockDefinition): block_definition = block - elif isinstance(block, compat_basestring): + elif isinstance(block, six.string_types): block_definition = BlockDefinition(block, block) else: block_definition = BlockDefinition(block[1], block[0]) diff --git a/classytags/tests.py b/classytags/tests.py index 8ac90f9..517ae25 100644 --- a/classytags/tests.py +++ b/classytags/tests.py @@ -10,6 +10,7 @@ from django.core.exceptions import ImproperlyConfigured from django.template import Context, RequestContext from django.test import RequestFactory +from django.utils import six from classytags import arguments from classytags import core @@ -20,7 +21,6 @@ from classytags import values from classytags.blocks import BlockDefinition from classytags.blocks import VariableBlockName -from classytags.compat import compat_next from classytags.test.context_managers import SettingsOverride from classytags.test.context_managers import TemplateTags @@ -530,7 +530,7 @@ def render_tag(self, context, values, varname): if self not in context.render_context: context.render_context[self] = itertools_cycle(values) cycle_iter = context.render_context[self] - value = compat_next(cycle_iter) + value = six.next(cycle_iter) if varname: context[varname] = value return value diff --git a/classytags/utils.py b/classytags/utils.py index 02b18e9..912311a 100644 --- a/classytags/utils.py +++ b/classytags/utils.py @@ -1,9 +1,9 @@ import re from copy import copy -from classytags.compat import compat_basestring from django.template import Context, RequestContext from django.template.context import BaseContext +from django.utils import six class NULL: @@ -19,7 +19,7 @@ class TemplateConstant(object): """ def __init__(self, value): self.literal = value - if isinstance(value, compat_basestring): + if isinstance(value, six.string_types): self.value = value.strip('"\'') else: self.value = value diff --git a/classytags/values.py b/classytags/values.py index df55d76..842ee31 100644 --- a/classytags/values.py +++ b/classytags/values.py @@ -2,8 +2,8 @@ from django import template from django.conf import settings +from django.utils import six -from classytags.compat import compat_basestring from classytags.exceptions import TemplateSyntaxWarning @@ -48,7 +48,7 @@ class StrictStringValue(StringValue): value_on_error = "" def clean(self, value): - if not isinstance(value, compat_basestring): + if not isinstance(value, six.string_types): return self.error(value, "clean") return value From 7c1661829f4169f168c6624c4f2d598f780b019a Mon Sep 17 00:00:00 2001 From: Tim Graham <timograham@gmail.com> Date: Tue, 28 Aug 2018 15:36:05 -0400 Subject: [PATCH 5/6] remove unneeded future import --- classytags/tests.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/classytags/tests.py b/classytags/tests.py index 517ae25..d842250 100644 --- a/classytags/tests.py +++ b/classytags/tests.py @@ -1,5 +1,3 @@ -from __future__ import with_statement - import os import sys import warnings
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor