8000 fix: Fall back to class name when app name is None by halitcelik · Pull Request #8059 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: Fall back to class name when app name is None #8059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds a check for CMSApps without name and test
  • Loading branch information
halitcelik committed Nov 4, 2024
commit 0b838ac5de257aa7715237f4e604435e284aad91
11 changes: 11 additions & 0 deletions cms/tests/test_check.py
< 8000 /tr>
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ def test_non_numeric_site_id(self):
with self.settings(SITE_ID='broken'):
self.assertCheck(False, warnings=0, errors=1)

def test_cmsapps_check(self):
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class AppWithoutName(CMSApp):
def get_urls(self, page=None, language=None, **kwargs):
return ["sampleapp.urls"]

app = apphook_pool.register(AppWithoutName)

self.assertCheck(True, warnings=1, errors=0)
apphook_pool.apps.pop(app.__name__)

class CheckWithDatabaseTests(CheckAssertMixin, TestCase):

Expand Down
12 changes: 12 additions & 0 deletions cms/utils/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,18 @@ def check_template_conf(output):
"Will run in headless mode with one placeholder called \"content\"")


@define_check
def check_cmsapps_names(output):
from cms.apphook_pool import apphook_pool
with output.section("Apphooks") as section:
for hook, name in apphook_pool.get_apphooks():
if apphook_pool.get_apphook(hook).name is None:
section.warn("CMSApps should define a name. %s doesn't have a name" % name)
if section.successful:
section.finish_success("CMSApps configuration is okay")



def check(output):
"""
Checks the configuration/environment of this django CMS installation.
Expand Down
0