Skip to content

Commit

Permalink
fix: workflow and django 4.2 compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
joshyu committed Mar 8, 2024
1 parent 65a7324 commit 67337ac
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 59 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.8, 3.9, 3.10 ] # latest release minus two
python-version: [ 3.8, 3.9, '3.10' ] # latest release minus two
requirements-file: [
django-3.2.txt,
django-4.2.txt
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.8, 3.9, 3.10 ] # latest release minus two
python-version: [ 3.8, 3.9, '3.10' ] # latest release minus two
requirements-file: [
django-3.2.txt,
django-4.2.txt,
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.8, 3.9, 3.10 ] # latest release minus two
python-version: [ 3.8, 3.9, '3.10' ] # latest release minus two
requirements-file: [
django-3.2.txt,
django-4.2.txt,
Expand Down
1 change: 0 additions & 1 deletion cms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
__version__ = '4.0.1.dev2'

default_app_config = 'cms.apps.CMSConfig'
2 changes: 1 addition & 1 deletion cms/cms_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from logging import getLogger
from collections import Iterable
from collections.abc import Iterable

from django.core.exceptions import ImproperlyConfigured

Expand Down
42 changes: 6 additions & 36 deletions cms/signals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,52 +13,22 @@
#################### Our own signals ###################

# fired after page location is changed - is moved from one node to other
page_moved = Signal(providing_args=["instance"])
page_moved = Signal()

# fired if a public page with an apphook is added or changed
urls_need_reloading = Signal(providing_args=[])
urls_need_reloading = Signal()

# *disclaimer*
# The generic object operation signals are very likely to change
# as their usage evolves.
# As a result, rely on these at your own risk
pre_obj_operation = Signal(
providing_args=[
"operation",
"request",
"token",
"obj",
]
)
pre_obj_operation = Signal()

post_obj_operation = Signal(
providing_args=[
"operation",
"request",
"token",
"obj",
]
)
post_obj_operation = Signal()

pre_placeholder_operation = Signal(
providing_args=[
"operation",
"request",
"language",
"token",
"origin",
]
)
pre_placeholder_operation = Signal()

post_placeholder_operation = Signal(
providing_args=[
"operation",
"request",
"language",
"token",
"origin",
]
)
post_placeholder_operation = Signal()


################### apphook reloading ###################
Expand Down
1 change: 0 additions & 1 deletion cms/test_utils/project/app_using_non_feature/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_using_non_feature.apps.NonFeatureCMSConfig'
1 change: 0 additions & 1 deletion cms/test_utils/project/app_with_bad_cms_file/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_bad_cms_file.apps.BadCMSFileConfig'
1 change: 0 additions & 1 deletion cms/test_utils/project/app_with_cms_config/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_cms_config.apps.CMSConfigConfig'
1 change: 0 additions & 1 deletion cms/test_utils/project/app_with_cms_feature/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_cms_feature.apps.CMSFeatureConfig'
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_cms_feature_and_config.apps.CMSFeatureAndConfigConfig'
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_feature_not_implemented.apps.CMSFeatureConfig'
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_two_cms_config_classes.apps.TwoCMSAppClassesConfig'
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_with_two_cms_feature_classes.apps.TwoCMSAppClassesConfig'
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_without_cms_app_class.apps.WithoutCMSAppClassConfig'
1 change: 0 additions & 1 deletion cms/test_utils/project/app_without_cms_file/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'cms.test_utils.project.app_without_cms_file.apps.WithoutCMSFileConfig'
7 changes: 5 additions & 2 deletions cms/test_utils/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

from cms.api import create_page, add_plugin
from cms.middleware.toolbar import ToolbarMiddleware
from cms.plugin_rendering import ContentRenderer, StructureRenderer
from cms.models import Page, PageContent
from cms.models.permissionmodels import (
GlobalPagePermission,
PagePermission,
PageUser,
)
from cms.plugin_rendering import ContentRenderer, StructureRenderer
from cms.test_utils.util.context_managers import UserLoginContext
from cms.utils.compat import DJANGO_4_1
from cms.utils.conf import get_cms_setting
from cms.utils.permissions import set_current_user
from cms.utils.urlutils import admin_reverse
Expand Down Expand Up @@ -663,4 +664,6 @@ class CMSTestCase(BaseCMSTestCase, testcases.TestCase):


class TransactionCMSTestCase(CMSTestCase, testcases.TransactionTestCase):
pass
if DJANGO_4_1:
def assertQuerySetEqual(self, *args, **kwargs):
return self.assertQuerysetEqual(*args, **kwargs)
7 changes: 7 additions & 0 deletions cms/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import django


if django.VERSION < (4, 2): # TODO: remove when dropping support for Django < 4.2
from django.test.testcases import TransactionTestCase

TransactionTestCase.assertQuerySetEqual = TransactionTestCase.assertQuerysetEqual
18 changes: 13 additions & 5 deletions cms/utils/compat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
from platform import python_version
from django import get_version

from distutils.version import LooseVersion

try:
from packaging.version import Version
except ModuleNotFoundError:
from distutils.version import LooseVersion as Version


DJANGO_VERSION = get_version()
PYTHON_VERSION = python_version()


# These means "less than or equal to DJANGO_FOO_BAR"
DJANGO_2_2 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.0')
DJANGO_3_0 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.1')
DJANGO_3_1 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.2')
DJANGO_3_2 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.3')
DJANGO_2_2 = Version(DJANGO_VERSION) < Version('3.0')
DJANGO_3_0 = Version(DJANGO_VERSION) < Version('3.1')
DJANGO_3_1 = Version(DJANGO_VERSION) < Version('3.2')
DJANGO_3_2 = Version(DJANGO_VERSION) < Version('3.3')
DJANGO_3 = Version(DJANGO_VERSION) < Version('4.0')
DJANGO_4_1 = Version(DJANGO_VERSION) < Version('4.2')
DJANGO_4_2 = Version(DJANGO_VERSION) < Version('4.3')
1 change: 0 additions & 1 deletion menus/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = 'menus.apps.MenusConfig'

0 comments on commit 67337ac

Please sign in to comment.