diff --git a/cms/admin/forms.py b/cms/admin/forms.py index 4c03f811fe..0efb19e193 100644 --- a/cms/admin/forms.py +++ b/cms/admin/forms.py @@ -820,7 +820,8 @@ def __init__(self, *args, **kwargs): def get_root_nodes(self): # TODO: this needs to avoid using the pages accessor directly nodes = TreeNode.get_root_nodes() - return nodes.exclude(cms_pages__is_page_type=not(self.page.is_page_type)) + is_page_type = self.page.is_page_type + return nodes.exclude(cms_pages__is_page_type=not is_page_type) def get_tree_options(self): position = self.cleaned_data['position'] diff --git a/cms/templatetags/cms_alias_tags.py b/cms/templatetags/cms_alias_tags.py index 9fd1d9a86b..8b21aec940 100644 --- a/cms/templatetags/cms_alias_tags.py +++ b/cms/templatetags/cms_alias_tags.py @@ -16,7 +16,7 @@ def render_alias_plugin(context, instance): # In edit mode, content is shown regardless of the source page publish status. # In published mode, content is shown only if the source page is published. - if not(toolbar.edit_mode_active) and source and source.page: + if not toolbar.edit_mode_active and source and source.page: # this is bad but showing unpublished content is worse can_see_content = source.page.is_published(instance.language) else: diff --git a/cms/tests/test_placeholder.py b/cms/tests/test_placeholder.py index 61149c7b24..122b7749f1 100644 --- a/cms/tests/test_placeholder.py +++ b/cms/tests/test_placeholder.py @@ -505,7 +505,7 @@ def test_plugins_language_fallback(self): # configure non fallback with self.settings(CMS_PLACEHOLDER_CONF=conf): # Deutsch page should have no text - del(placeholder_de._plugins_cache) + del placeholder_de._plugins_cache cache.clear() content_de = _render_placeholder(placeholder_de, context_de) # Deutsch page should inherit english content @@ -516,12 +516,12 @@ def test_plugins_language_fallback(self): request.user = self.get_superuser() request.toolbar = CMSToolbar(request) context_de2['request'] = request - del(placeholder_de._plugins_cache) + del placeholder_de._plugins_cache cache.clear() content_de2 = _render_placeholder(placeholder_de, context_de2) self.assertFalse("en body" in content_de2) # remove the cached plugins instances - del(placeholder_de._plugins_cache) + del placeholder_de._plugins_cache cache.clear() # Then we add a plugin to check for proper rendering add_plugin(placeholder_de, 'TextPlugin', 'de', body='de body') @@ -557,12 +557,12 @@ def test_nested_plugins_language_fallback(self): request.user = self.get_superuser() request.toolbar = CMSToolbar(request) context_de2['request'] = request - del(placeholder_de._plugins_cache) + del placeholder_de._plugins_cache cache.clear() content_de2 = _render_placeholder(placeholder_de, context_de2) self.assertFalse("en body" in content_de2) # remove the cached plugins instances - del(placeholder_de._plugins_cache) + del placeholder_de._plugins_cache cache.clear() # Then we add a plugin to check for proper rendering link_de = add_plugin( @@ -594,13 +594,13 @@ def test_plugins_non_default_language_fallback(self): # Deutsch page should have the text plugin content_de = _render_placeholder(placeholder_en, context_de) self.assertRegexpMatches(content_de, "^de body$") - del(placeholder_en._plugins_cache) + del placeholder_en._plugins_cache cache.clear() # English page should have no text content_en = _render_placeholder(placeholder_en, context_en) self.assertRegexpMatches(content_en, "^de body$") self.assertEqual(len(content_en), 7) - del(placeholder_en._plugins_cache) + del placeholder_en._plugins_cache cache.clear() conf = { 'col_left': { @@ -614,7 +614,7 @@ def test_plugins_non_default_language_fallback(self): self.assertNotRegex(content_en, "^de body$") # remove the cached plugins instances - del(placeholder_en._plugins_cache) + del placeholder_en._plugins_cache cache.clear() # Then we add a plugin to check for proper rendering add_plugin(placeholder_en, 'TextPlugin', 'en', body='en body') @@ -650,7 +650,7 @@ def test_plugins_discarded_with_language_fallback(self): self.assertRegexpMatches(content_en, "^en body$") # remove the cached plugins instances - del(placeholder_sidebar_en._plugins_cache) + del placeholder_sidebar_en._plugins_cache cache.clear() def test_plugins_prepopulate(self): diff --git a/cms/wizards/forms.py b/cms/wizards/forms.py index b4b1c462ad..94818ffe60 100755 --- a/cms/wizards/forms.py +++ b/cms/wizards/forms.py @@ -73,7 +73,7 @@ class Media: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - # set the entries here to get an up to date list of entries. + # set the entries here to get an up-to-date list of entries. self.fields['entry'].choices = entry_choices( user=self.user, page=self.page, @@ -82,7 +82,7 @@ def __init__(self, *args, **kwargs): def get_wizard_entries(self): for entry in self['entry']: wizard = wizard_pool.get_entry(entry.choice_value) - yield(entry, wizard) + yield (entry, wizard) class WizardStep2BaseForm(BaseFormMixin): diff --git a/setup.cfg b/setup.cfg index 9d23912160..e9f1c9a8f9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,10 @@ universal=1 [flake8] +exclude = + .env, + .venv, + **/migrations/** ignore=E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E203,E221,E225,E226,E231,E241,E251,E261,E262,E265,E271,E301,E302,E303,E501,E502,E701,E713,E714,E731,F401,F403 max-line-length = 119