Skip to content

Commit

Permalink
Merge pull request #1 from joshyu/feat/django-42-compatible
Browse files Browse the repository at this point in the history
Feat/django 42 compatible
  • Loading branch information
vipulnarang95 authored Mar 8, 2024
2 parents 65a7324 + 5925f9d commit 2f237ce
Show file tree
Hide file tree
Showing 17 changed files with 28 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)
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 2f237ce

Please sign in to comment.