Skip to content

Commit 57dc980

Browse files
committedMar 26, 2025
fix: Checks at startup crashed
1 parent 804ea37 commit 57dc980

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed
 

‎CHANGELOG.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Changelog
33
=========
44

5-
0.8.1 (26-03-2025)
5+
0.8.2 (26-03-2025)
66
==================
77

88
* fix: Add warning due to changed CKEditor 4 setting by @fsbraun in https://github.com/django-cms/djangocms-text/pull/68
9+
* fix: Checks at startup crashed
910

1011

1112
0.8.0 (12-03-2025)

‎djangocms_text/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
10. Github actions will publish the new package to pypi
1717
"""
1818

19-
__version__ = "0.8.1"
19+
__version__ = "0.8.2"

‎djangocms_text/apps.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,19 @@ def check_ckeditor_settings(app_configs, **kwargs) -> list: # pragma: no cover
8686
obj="settings.TEXT_ADDITIONAL_ATTRIBUTES",
8787
)
8888
)
89-
warnings += check_ckeditor_settings_dict(settings)
89+
if check_ckeditor_cms_plugin_settings(settings):
90+
warnings.append(
91+
Warning(
92+
"The CKEDITOR_SETTINGS toolbar setting has changed: Instead of 'cmsplugins' use 'CMSPlugins'.",
93+
hint="Replace 'cmspluings' by 'CMSPlugins' in CKEDITOR_SETTINGS.",
94+
id="text.W003",
95+
)
96+
)
9097

9198
return warnings
9299

93100

94-
def check_ckeditor_settings_dict(settings: object) -> list: # pragma: no cover
101+
def check_ckeditor_cms_plugin_settings(settings: object) -> list: # pragma: no cover
95102
def recursive_replace(config_list: list, old: str, new: str):
96103
"""Replace target string in toolbar lists and return True if any change occurred."""
97104
changed = False
@@ -111,17 +118,11 @@ def recursive_replace(config_list: list, old: str, new: str):
111118

112119
for key, value in ckeditor_settings.items():
113120
if "toolbar" in key and isinstance(value, list):
114-
change_required = recursive_replace(ckeditor_settings[key], "cmsplugins", "CMSPlugins")
115-
116-
if change_required:
117-
return [
118-
Warning(
119-
"The CKEDITOR_SETTINGS toolbar setting has changed: Instead of 'cmsplugins' use 'CMSPlugins'.",
120-
hint="Replace 'cmspluings' by 'CMSPlugins' in CKEDITOR_SETTINGS.",
121-
id="text.W003",
121+
change_required = change_required or recursive_replace(
122+
ckeditor_settings[key], "cmsplugins", "CMSPlugins"
122123
)
123-
]
124-
return []
124+
return change_required
125+
return False
125126

126127

127128
def check_no_cms_config(app_configs, **kwargs) -> list: # pragma: no cover

0 commit comments

Comments
 (0)