diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 27471d9d127..f2b9cc24691 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -15,6 +15,6 @@ jobs: name: Validate PR title runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5.5.2 + - uses: amannn/action-semantic-pull-request@v5.5.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 22f757d03dc..db738c59622 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -16,7 +16,7 @@ jobs: - run: python -Im pip install --user ruff - name: Run ruff on cms - run: ruff --output-format=github cms + run: ruff check --output-format=github cms - name: Run ruff on menus - run: ruff --output-format=github menus + run: ruff check --output-format=github menus diff --git a/cms/forms/utils.py b/cms/forms/utils.py index 419d892ae6f..abf7f0f445f 100644 --- a/cms/forms/utils.py +++ b/cms/forms/utils.py @@ -47,13 +47,13 @@ def get_page_choices_for_site(site, language): for page in pages: translations = page.filtered_translations - titles_by_language = {trans.language: trans.title for trans in translations} + pagecontent_by_language = {trans.language: trans.title for trans in translations} - for language in languages: + for lang in languages: # EmptyPageContent is used to prevent the cms from trying # to find a translation in the database - if language in titles_by_language: - title = titles_by_language[language] + if lang in pagecontent_by_language: + title = pagecontent_by_language[lang] indent = "  " * (page.node.depth - 1) label = mark_safe(f"{indent}{escape(title)}") yield (page.pk, label) diff --git a/cms/models/pagemodel.py b/cms/models/pagemodel.py index 2c94b8f593a..9f05ff196bf 100644 --- a/cms/models/pagemodel.py +++ b/cms/models/pagemodel.py @@ -657,8 +657,8 @@ def clear_cache(self, language=None, menu=False, placeholder=False): placeholders = self.get_placeholders(language) - for placeholder in placeholders: - placeholder.clear_cache(language, site_id=self.node.site_id) + for placeholder_instance in placeholders: + placeholder_instance.clear_cache(language, site_id=self.node.site_id) if menu: # Clears all menu caches for this page's site diff --git a/cms/plugin_pool.py b/cms/plugin_pool.py index cf73b757c43..3dbb47dbe08 100644 --- a/cms/plugin_pool.py +++ b/cms/plugin_pool.py @@ -56,24 +56,24 @@ def validate_templates(self, plugin=None): plugins = [plugin] else: plugins = self.plugins.values() - for plugin in plugins: - if (plugin.render_plugin and not type(plugin.render_plugin) == property - or hasattr(plugin.model, 'render_template') - or hasattr(plugin, 'get_render_template')): - if (plugin.render_template is None and not hasattr(plugin, 'get_render_template')): + for plugin_class in plugins: + if (plugin_class.render_plugin and type(plugin_class.render_plugin) is not property + or hasattr(plugin_class.model, 'render_template') + or hasattr(plugin_class, 'get_render_template')): + if (plugin_class.render_template is None and not hasattr(plugin_class, 'get_render_template')): raise ImproperlyConfigured( "CMS Plugins must define a render template, " "a get_render_template method or " - "set render_plugin=False: %s" % plugin + "set render_plugin=False: %s" % plugin_class ) # If plugin class defines get_render_template we cannot # statically check for valid template file as it depends # on plugin configuration and context. # We cannot prevent developer to shoot in the users' feet - elif not hasattr(plugin, 'get_render_template'): + elif not hasattr(plugin_class, 'get_render_template'): from django.template import loader - template = plugin.render_template + template = plugin_class.render_template if isinstance(template, str) and template: try: loader.get_template(template) @@ -85,17 +85,17 @@ def validate_templates(self, plugin=None): if str(e) == template: raise ImproperlyConfigured( "CMS Plugins must define a render template (%s) that exists: %s" - % (plugin, template) + % (plugin_class, template) ) else: pass except TemplateSyntaxError: pass else: - if plugin.allow_children: + if plugin_class.allow_children: raise ImproperlyConfigured( "CMS Plugins can not define render_plugin=False and allow_children=True: %s" - % plugin + % plugin_class ) def register_plugin(self, plugin): diff --git a/cms/toolbar/utils.py b/cms/toolbar/utils.py index 2e7c0942f84..4f686ee3316 100644 --- a/cms/toolbar/utils.py +++ b/cms/toolbar/utils.py @@ -101,8 +101,8 @@ def collect_plugin_data(plugin): tree_data.append(plugin_info) - for plugin in plugin.child_plugin_instances: - collect_plugin_data(plugin) + for plugin_instance in plugin.child_plugin_instances: + collect_plugin_data(plugin_instance) with force_language(toolbar.toolbar_language): for root_plugin in root_plugins: