diff options
author | Mathieu Pillard <diox@users.noreply.github.com> | 2022-02-23 01:28:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-23 01:28:04 +0100 |
commit | be782489af21b51cad2e8a60dd6b0a3bed20bff3 (patch) | |
tree | 87ee8547cfa1671a190776460bfb0522f2ab2bee | |
parent | 6a6bae8e590913e06f6b32587ab793fe18b3b767 (diff) | |
download | django-compressor-be782489af21b51cad2e8a60dd6b0a3bed20bff3.tar.gz |
Deprecate SlimItFilter, stop testing it with Python 3.7+ (#1102)
* Deprecate SlimItFilter, stop testing it with Python 3.7+
-rw-r--r-- | compressor/filters/jsmin/__init__.py | 17 | ||||
-rw-r--r-- | compressor/tests/test_filters.py | 3 | ||||
-rw-r--r-- | docs/changelog.txt | 8 | ||||
-rw-r--r-- | docs/quickstart.txt | 7 | ||||
-rw-r--r-- | docs/settings.txt | 7 |
5 files changed, 23 insertions, 19 deletions
diff --git a/compressor/filters/jsmin/__init__.py b/compressor/filters/jsmin/__init__.py index 3a2aade..c1a64cf 100644 --- a/compressor/filters/jsmin/__init__.py +++ b/compressor/filters/jsmin/__init__.py @@ -1,3 +1,5 @@ +import warnings + from django.core.exceptions import ImproperlyConfigured from compressor.filters import FilterBase, CallbackOutputFilter @@ -6,9 +8,7 @@ from compressor.filters import FilterBase, CallbackOutputFilter class rJSMinFilter(CallbackOutputFilter): callback = "rjsmin.jsmin" dependencies = ["rjsmin"] - kwargs = { - "keep_bang_comments": True - } + kwargs = {"keep_bang_comments": True} # This is for backwards compatibility @@ -22,6 +22,14 @@ class SlimItFilter(CallbackOutputFilter): "mangle": True, } + def __init__(self, *args, **kwargs): + warnings.warn( + "SlimItFilter is broken in Python 3.6+ and will be removed in " + "django-compressor 3.3.", + DeprecationWarning, + ) + super().__init__(*args, **kwargs) + class CalmjsFilter(FilterBase): def __init__(self, *args, **kwargs): @@ -39,7 +47,8 @@ class CalmjsFilter(FilterBase): except ImportError: raise ImproperlyConfigured( "The module calmjs.parse couldn't be imported. " - "Make sure it is correctly installed.") + "Make sure it is correctly installed." + ) if self._parser is None: self._parser = calmjs.parse.es5 if self._unparser is None: diff --git a/compressor/tests/test_filters.py b/compressor/tests/test_filters.py index 49716b7..ddcfab0 100644 --- a/compressor/tests/test_filters.py +++ b/compressor/tests/test_filters.py @@ -2,7 +2,7 @@ import io import os import sys from collections import defaultdict -from unittest import mock +from unittest import mock, skipIf from django.conf import settings from django.test import override_settings, TestCase @@ -202,6 +202,7 @@ class JsMinTestCase(TestCase): self.assertEqual(output, rJSMinFilter(content).output()) +@skipIf(sys.version_info >= (3, 7), reason="Unsupported in Python 3.7+") class SlimItTestCase(TestCase): def test_slimit_filter(self): content = """ diff --git a/docs/changelog.txt b/docs/changelog.txt index 3d19a44..4f75b41 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,6 +1,14 @@ Changelog ========= +v3.2 (unreleased) +----------------- + +`Full Changelog <https://github.com/django-compressor/django-compressor/compare/3.1...3.2>`_ + +- Deprecate SlimItFilter, stop testing it with Python 3.7 or higher + + v3.1 (2021-12-18) ----------------- diff --git a/docs/quickstart.txt b/docs/quickstart.txt index 86d09c2..f6f23a4 100644 --- a/docs/quickstart.txt +++ b/docs/quickstart.txt @@ -64,13 +64,6 @@ Optional Dependencies pip install html5lib -- `Slim It`_ - - For the :ref:`Slim It filter <slimit_filter>` - ``compressor.filters.jsmin.SlimItFilter``:: - - pip install slimit - - `Calmjs`_ For the :ref:`Calmjs filter <calmjs_filter>` diff --git a/docs/settings.txt b/docs/settings.txt index 456547c..e348539 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -201,13 +201,6 @@ Backend settings A filter that uses the jsmin implementation rJSmin_ to compress JavaScript code (installed by default). - .. _slimit_filter: - - - ``compressor.filters.jsmin.SlimItFilter`` - - A filter that uses the jsmin implementation `Slim It`_ to compress - JavaScript code. - .. _calmjs_filter: - ``compressor.filters.jsmin.CalmjsFilter`` |