diff --git a/setup.py b/setup.py
index a545cae7..5fcc3e14 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,6 @@
import djangocms_alias
-
CLASSIFIERS = [
"Environment :: Web Environment",
"Framework :: Django",
diff --git a/test_settings.py b/test_settings.py
index a3facd1f..9edd3d20 100644
--- a/test_settings.py
+++ b/test_settings.py
@@ -1,7 +1,6 @@
import os
from distutils.util import strtobool
-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ENABLE_VERSIONING = strtobool(os.environ.get("ENABLE_VERSIONING", "1"))
EXTRA_INSTALLED_APPS = []
diff --git a/tests/base.py b/tests/base.py
index 3bfe1aa3..3a3061b3 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -1,8 +1,3 @@
-from django.contrib.auth import get_permission_codename
-from django.contrib.auth.models import Permission
-from django.http import QueryDict
-from django.test.client import RequestFactory
-
from cms.api import add_plugin, create_page, create_page_content
from cms.middleware.toolbar import ToolbarMiddleware
from cms.test_utils.testcases import CMSTestCase
@@ -13,6 +8,10 @@
)
from cms.utils.conf import get_cms_setting
from cms.utils.urlutils import admin_reverse
+from django.contrib.auth import get_permission_codename
+from django.contrib.auth.models import Permission
+from django.http import QueryDict
+from django.test.client import RequestFactory
from djangocms_alias.constants import (
CATEGORY_LIST_URL_NAME,
@@ -21,7 +20,8 @@
DETACH_ALIAS_PLUGIN_URL_NAME,
LIST_ALIAS_URL_NAME,
)
-from djangocms_alias.models import Alias as AliasModel, AliasContent, Category
+from djangocms_alias.models import Alias as AliasModel
+from djangocms_alias.models import AliasContent, Category
from djangocms_alias.utils import is_versioning_enabled
diff --git a/tests/requirements/compile.py b/tests/requirements/compile.py
index e334076c..7fd78bc9 100755
--- a/tests/requirements/compile.py
+++ b/tests/requirements/compile.py
@@ -6,7 +6,6 @@
import sys
from pathlib import Path
-
COMPILE_SETTINGS = {
"py39-dj32-cms41": [],
"py310-dj32-cms41": [],
diff --git a/tests/test_admin.py b/tests/test_admin.py
index b2708289..fc9bf57f 100644
--- a/tests/test_admin.py
+++ b/tests/test_admin.py
@@ -1,26 +1,26 @@
from unittest import skipUnless
+from bs4 import BeautifulSoup
+from cms.api import add_plugin
+from cms.utils.i18n import force_language
+from cms.utils.urlutils import add_url_parameters, admin_reverse
from django.contrib.auth.models import Permission
from django.urls import reverse
from django.utils.formats import localize
from django.utils.timezone import localtime
-from cms.api import add_plugin
-from cms.utils.i18n import force_language
-from cms.utils.urlutils import add_url_parameters, admin_reverse
-
-from bs4 import BeautifulSoup
-
from djangocms_alias.constants import (
CHANGE_ALIAS_URL_NAME,
USAGE_ALIAS_URL_NAME,
)
from djangocms_alias.models import (
Alias,
- Alias as AliasModel,
AliasContent,
Category,
)
+from djangocms_alias.models import (
+ Alias as AliasModel,
+)
from djangocms_alias.utils import is_versioning_enabled
from tests.base import BaseAliasPluginTestCase
diff --git a/tests/test_admin_filters.py b/tests/test_admin_filters.py
index fb9deaf5..54e905b2 100644
--- a/tests/test_admin_filters.py
+++ b/tests/test_admin_filters.py
@@ -1,16 +1,16 @@
from unittest import skipUnless
+from cms.utils import get_current_site
from django.contrib import admin
from django.contrib.sites.models import Site
-from cms.utils import get_current_site
-
from djangocms_alias.constants import (
SITE_FILTER_NO_SITE_VALUE,
SITE_FILTER_URL_PARAM,
)
from djangocms_alias.filters import CategoryFilter
-from djangocms_alias.models import Alias as AliasModel, AliasContent, Category
+from djangocms_alias.models import Alias as AliasModel
+from djangocms_alias.models import AliasContent, Category
from djangocms_alias.utils import is_versioning_enabled
from .base import BaseAliasPluginTestCase
diff --git a/tests/test_models.py b/tests/test_models.py
index 739d815a..3283af2b 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -1,20 +1,19 @@
from distutils.version import LooseVersion
+from cms.api import add_plugin, create_title
+from cms.models import Placeholder
from django import get_version
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.urls import reverse
-from cms.api import add_plugin, create_title
-from cms.models import Placeholder
-
from djangocms_alias.cms_plugins import Alias
-from djangocms_alias.models import Alias as AliasModel, AliasContent, Category
+from djangocms_alias.models import Alias as AliasModel
+from djangocms_alias.models import AliasContent, Category
from djangocms_alias.utils import is_versioning_enabled
from .base import BaseAliasPluginTestCase
-
DJANGO_VERSION = get_version()
DJANGO_4_0 = LooseVersion(DJANGO_VERSION) < LooseVersion("4.1")
diff --git a/tests/test_permissions.py b/tests/test_permissions.py
index 423989e9..14cf90eb 100644
--- a/tests/test_permissions.py
+++ b/tests/test_permissions.py
@@ -1,8 +1,7 @@
+from cms.api import add_plugin
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
-from cms.api import add_plugin
-
from djangocms_alias.cms_plugins import Alias
from djangocms_alias.models import Alias as AliasModel
from djangocms_alias.utils import is_versioning_enabled
diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py
index 9876257c..f1baf94a 100644
--- a/tests/test_templatetags.py
+++ b/tests/test_templatetags.py
@@ -1,14 +1,14 @@
from unittest import skipUnless
-from django.contrib.sites.models import Site
-from django.test.utils import override_settings
-
from cms.api import add_plugin, create_page, create_page_content
from cms.toolbar.utils import get_object_edit_url, get_object_preview_url
+from django.contrib.sites.models import Site
+from django.test.utils import override_settings
from djangocms_alias.cms_plugins import Alias
from djangocms_alias.constants import DEFAULT_STATIC_ALIAS_CATEGORY_NAME
-from djangocms_alias.models import Alias as AliasModel, Category
+from djangocms_alias.models import Alias as AliasModel
+from djangocms_alias.models import Category
from djangocms_alias.utils import is_versioning_enabled
from .base import BaseAliasPluginTestCase
diff --git a/tests/test_toolbar.py b/tests/test_toolbar.py
index b0b1fdb3..6f633df0 100644
--- a/tests/test_toolbar.py
+++ b/tests/test_toolbar.py
@@ -2,9 +2,6 @@
from collections import ChainMap
from unittest import skipUnless
-from django.contrib.auth.models import Permission
-from django.urls import reverse
-
from cms.cms_toolbars import (
ADMIN_MENU_IDENTIFIER,
ADMINISTRATION_BREAK,
@@ -14,6 +11,8 @@
from cms.toolbar.utils import get_object_edit_url
from cms.utils.i18n import force_language
from cms.utils.urlutils import admin_reverse
+from django.contrib.auth.models import Permission
+from django.urls import reverse
from djangocms_alias.cms_toolbars import ALIAS_MENU_IDENTIFIER
from djangocms_alias.constants import USAGE_ALIAS_URL_NAME
diff --git a/tests/test_views.py b/tests/test_views.py
index 955c7174..18261c95 100644
--- a/tests/test_views.py
+++ b/tests/test_views.py
@@ -1,17 +1,16 @@
import re
from unittest import skip, skipIf, skipUnless
-from django.contrib.auth.models import Permission
-from django.contrib.contenttypes.models import ContentType
-from django.contrib.sites.models import Site
-from django.test.utils import override_settings
-
from cms.api import add_plugin
from cms.models import Placeholder
from cms.utils import get_current_site
from cms.utils.i18n import force_language
from cms.utils.plugins import downcast_plugins
from cms.utils.urlutils import add_url_parameters, admin_reverse
+from django.contrib.auth.models import Permission
+from django.contrib.contenttypes.models import ContentType
+from django.contrib.sites.models import Site
+from django.test.utils import override_settings
from djangocms_alias.constants import (
CATEGORY_SELECT2_URL_NAME,
diff --git a/tests/test_wizards.py b/tests/test_wizards.py
index 42803484..a74e9013 100644
--- a/tests/test_wizards.py
+++ b/tests/test_wizards.py
@@ -1,9 +1,8 @@
-from django.contrib.sites.models import Site
-from django.utils import translation
-
from cms.utils import get_current_site
from cms.wizards.forms import WizardStep2BaseForm, step2_form_factory
from cms.wizards.helpers import get_entries as get_wizard_entires
+from django.contrib.sites.models import Site
+from django.utils import translation
from djangocms_alias.models import Category
from djangocms_alias.utils import is_versioning_enabled
From 3f5553707f43c7b5d12344bb9098a29cef5c733c Mon Sep 17 00:00:00 2001
From: Raffaella <45825990+raffaellasuardini@users.noreply.github.com>
Date: Mon, 19 Feb 2024 14:55:27 +0100
Subject: [PATCH 2/3] Fix Sync pre-commit checks (#216) (#226)
* chore: solved rule E501 (line too long)
* chore: solved UP032 (use f-string)
* fix: update pyproject.toml to solve issue #216
* ci: auto fixes from pre-commit hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
---
djangocms_alias/admin.py | 19 ++---
djangocms_alias/cms_config.py | 11 +--
djangocms_alias/cms_menus.py | 4 +-
djangocms_alias/cms_plugins.py | 13 +---
djangocms_alias/cms_toolbars.py | 30 ++------
djangocms_alias/filters.py | 18 +----
djangocms_alias/forms.py | 20 ++---
djangocms_alias/migrations/0001_initial.py | 4 +-
.../0004_alter_aliascontent_language.py | 4 +-
djangocms_alias/models.py | 22 ++----
.../templatetags/djangocms_alias_tags.py | 20 ++---
djangocms_alias/views.py | 4 +-
pyproject.toml | 18 +++--
tests/base.py | 45 +++--------
tests/test_admin.py | 64 +++++-----------
tests/test_admin_filters.py | 76 +++++--------------
tests/test_cms_plugins.py | 21 ++---
tests/test_templatetags.py | 58 ++++----------
tests/test_toolbar.py | 36 +++------
tests/test_views.py | 56 ++++----------
tests/test_wizards.py | 14 +---
21 files changed, 145 insertions(+), 412 deletions(-)
diff --git a/djangocms_alias/admin.py b/djangocms_alias/admin.py
index d6051879..0f329543 100644
--- a/djangocms_alias/admin.py
+++ b/djangocms_alias/admin.py
@@ -91,9 +91,7 @@ def get_actions_list(self) -> list:
"""Add alias usage list actions"""
return super().get_actions_list() + [self._get_alias_usage_link]
- def can_change_content(
- self, request: HttpRequest, content_obj: AliasContent
- ) -> bool:
+ def can_change_content(self, request: HttpRequest, content_obj: AliasContent) -> bool:
"""Returns True if user can change content_obj"""
if content_obj and is_versioning_enabled():
version = Version.objects.get_for_content(content_obj)
@@ -111,9 +109,7 @@ def has_delete_permission(self, request: HttpRequest, obj: Alias = None) -> bool
return request.user.is_superuser
return False
- def save_model(
- self, request: HttpRequest, obj: Alias, form: forms.Form, change: bool
- ) -> None:
+ def save_model(self, request: HttpRequest, obj: Alias, form: forms.Form, change: bool) -> None:
super().save_model(request, obj, form, change)
# Only emit content changes if Versioning is not installed because
@@ -147,9 +143,7 @@ def delete_model(self, request: HttpRequest, obj: Alias):
sender=self.model,
)
- def _get_alias_usage_link(
- self, obj: Alias, request: HttpRequest, disabled: bool = False
- ) -> str:
+ def _get_alias_usage_link(self, obj: Alias, request: HttpRequest, disabled: bool = False) -> str:
url = admin_reverse(USAGE_ALIAS_URL_NAME, args=[obj.pk])
return self.admin_action_button(url, "info", _("View usage"), disabled=disabled)
@@ -169,9 +163,7 @@ class AliasContentAdmin(admin.ModelAdmin):
actions = None
change_form_template = "admin/djangocms_alias/aliascontent/change_form.html"
- def changelist_view(
- self, request: HttpRequest, extra_context: dict = None
- ) -> HttpResponse:
+ def changelist_view(self, request: HttpRequest, extra_context: dict = None) -> HttpResponse:
"""Needed for the Alias Content Admin breadcrumbs"""
return HttpResponseRedirect(
admin_reverse(
@@ -191,8 +183,7 @@ def change_view(
if not obj:
raise Http404()
return HttpResponseRedirect(
- admin_reverse(CHANGE_ALIAS_URL_NAME, args=(obj.alias_id,))
- + f"?language={obj.language}"
+ admin_reverse(CHANGE_ALIAS_URL_NAME, args=(obj.alias_id,)) + f"?language={obj.language}"
)
def has_module_permission(self, request: HttpRequest) -> bool:
diff --git a/djangocms_alias/cms_config.py b/djangocms_alias/cms_config.py
index 573057d7..027278d7 100644
--- a/djangocms_alias/cms_config.py
+++ b/djangocms_alias/cms_config.py
@@ -19,12 +19,9 @@ class AliasCMSConfig(CMSAppConfig):
cms_toolbar_enabled_models = [(AliasContent, render_alias_content)]
moderated_models = [AliasContent]
- djangocms_moderation_enabled = getattr(
- settings, "MODERATING_ALIAS_MODELS_ENABLED", True
- )
+ djangocms_moderation_enabled = getattr(settings, "MODERATING_ALIAS_MODELS_ENABLED", True)
djangocms_versioning_enabled = (
- getattr(settings, "VERSIONING_ALIAS_MODELS_ENABLED", True)
- and djangocms_versioning_installed
+ getattr(settings, "VERSIONING_ALIAS_MODELS_ENABLED", True) and djangocms_versioning_installed
)
if djangocms_versioning_enabled:
@@ -42,9 +39,7 @@ class AliasCMSConfig(CMSAppConfig):
),
]
- djangocms_references_enabled = getattr(
- settings, "REFERENCES_ALIAS_MODELS_ENABLED", True
- )
+ djangocms_references_enabled = getattr(settings, "REFERENCES_ALIAS_MODELS_ENABLED", True)
reference_fields = [
(AliasPlugin, "alias"),
]
diff --git a/djangocms_alias/cms_menus.py b/djangocms_alias/cms_menus.py
index bfad7a62..cb9bc320 100644
--- a/djangocms_alias/cms_menus.py
+++ b/djangocms_alias/cms_menus.py
@@ -9,9 +9,7 @@ class AliasDisableMenu(Modifier):
"""Disable menu rendering on alias pages"""
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
- if request.toolbar.app_name == PLUGIN_URL_NAME_PREFIX or isinstance(
- request.toolbar.obj, AliasContent
- ):
+ if request.toolbar.app_name == PLUGIN_URL_NAME_PREFIX or isinstance(request.toolbar.obj, AliasContent):
return []
return nodes
diff --git a/djangocms_alias/cms_plugins.py b/djangocms_alias/cms_plugins.py
index 6214209e..f440106e 100644
--- a/djangocms_alias/cms_plugins.py
+++ b/djangocms_alias/cms_plugins.py
@@ -32,10 +32,7 @@ class Alias(CMSPluginBase):
form = AliasPluginForm
def get_render_template(self, context, instance, placeholder):
- if (
- isinstance(instance.placeholder.source, AliasContent)
- and instance.is_recursive()
- ):
+ if isinstance(instance.placeholder.source, AliasContent) and instance.is_recursive():
return "djangocms_alias/alias_recursive.html"
return f"djangocms_alias/{instance.template}/alias.html"
@@ -115,9 +112,7 @@ def can_create_alias(cls, user, plugins=None, replace=False):
return True
elif replace:
target_placeholder = plugins[0].placeholder
- if not target_placeholder.check_source(user) or not has_plugin_permission(
- user, Alias.__name__, "add"
- ):
+ if not target_placeholder.check_source(user) or not has_plugin_permission(user, Alias.__name__, "add"):
return False
return all(
@@ -142,9 +137,7 @@ def can_detach(cls, user, target_placeholder, plugins):
@classmethod
def detach_alias_plugin(cls, plugin, language):
- source_placeholder = plugin.alias.get_placeholder(
- language, show_draft_content=True
- ) # We're in edit mode
+ source_placeholder = plugin.alias.get_placeholder(language, show_draft_content=True) # We're in edit mode
target_placeholder = plugin.placeholder
# Deleting uses a copy of a plugin to preserve pk on existing
diff --git a/djangocms_alias/cms_toolbars.py b/djangocms_alias/cms_toolbars.py
index 4c42b6fa..87f102c5 100644
--- a/djangocms_alias/cms_toolbars.py
+++ b/djangocms_alias/cms_toolbars.py
@@ -71,11 +71,7 @@ def add_aliases_link_to_admin_menu(self):
url = admin_reverse(LIST_ALIAS_URL_NAME)
obj = self.toolbar.get_object()
- language = (
- obj.language
- if hasattr(obj, "language")
- else get_language_from_request(self.request)
- )
+ language = obj.language if hasattr(obj, "language") else get_language_from_request(self.request)
if language is None:
language = get_default_language()
url += f'?{urlencode({"language": language})}'
@@ -152,9 +148,7 @@ def get_insert_position(cls, admin_menu, item_name):
return end.index
def enable_create_wizard_button(self):
- button_lists = [
- result.item for result in self.toolbar.find_items(item_type=ButtonList)
- ]
+ button_lists = [result.item for result in self.toolbar.find_items(item_type=ButtonList)]
buttons = list(
# flatten the list
itertools.chain.from_iterable([item.buttons for item in button_lists])
@@ -162,9 +156,7 @@ def enable_create_wizard_button(self):
# There will always be this button, because we are in the context of
# alias app views
- create_wizard_button = [
- button for button in buttons if button.name == gettext("Create")
- ][0]
+ create_wizard_button = [button for button in buttons if button.name == gettext("Create")][0]
from cms.wizards.wizard_pool import entry_choices
@@ -195,9 +187,7 @@ def override_language_switcher(self):
if alias_content:
with force_language(code):
url = alias_content.get_absolute_url()
- language_menu.add_link_item(
- name, url=url, active=self.current_lang == code
- )
+ language_menu.add_link_item(name, url=url, active=self.current_lang == code)
def change_language_menu(self):
if self.toolbar.edit_mode_active and isinstance(self.toolbar.obj, AliasContent):
@@ -217,17 +207,13 @@ def change_language_menu(self):
current_placeholder = alias_content.placeholder
remove = [
- (code, languages.get(code, code))
- for code in alias_content.alias.get_languages()
- if code in languages
+ (code, languages.get(code, code)) for code in alias_content.alias.get_languages() if code in languages
]
add = [code for code in languages.items() if code not in remove]
copy = [
(code, name)
for code, name in languages.items()
- if code != self.current_lang
- and (code, name) in remove
- and current_placeholder
+ if code != self.current_lang and (code, name) in remove and current_placeholder
]
if add or remove or copy:
@@ -241,9 +227,7 @@ def change_language_menu(self):
add_url = admin_reverse("djangocms_alias_aliascontent_add")
for code, name in add:
- url = add_url_parameters(
- add_url, language=code, alias=alias_content.alias_id
- )
+ url = add_url_parameters(add_url, language=code, alias=alias_content.alias_id)
add_plugins_menu.add_modal_item(name, url=url)
if remove:
diff --git a/djangocms_alias/filters.py b/djangocms_alias/filters.py
index eab9bfc4..e16e9250 100644
--- a/djangocms_alias/filters.py
+++ b/djangocms_alias/filters.py
@@ -38,17 +38,13 @@ def choices(self, changelist):
}
yield {
"selected": self.value() == SITE_FILTER_NO_SITE_VALUE,
- "query_string": changelist.get_query_string(
- {self.parameter_name: SITE_FILTER_NO_SITE_VALUE}
- ),
+ "query_string": changelist.get_query_string({self.parameter_name: SITE_FILTER_NO_SITE_VALUE}),
"display": _("No site"),
}
for lookup, title in self.lookup_choices:
yield {
"selected": self.value() == str(lookup),
- "query_string": changelist.get_query_string(
- {self.parameter_name: lookup}
- ),
+ "query_string": changelist.get_query_string({self.parameter_name: lookup}),
"display": title,
}
@@ -62,11 +58,7 @@ def lookups(self, request, model_admin):
qs = model_admin.get_queryset(request)
cat_id = qs.values_list("category", flat=True)
# Ensure the category is ordered by the name alphabetically by default
- cat = (
- Category.objects.filter(pk__in=cat_id)
- .translated(get_language())
- .order_by("translations__name")
- )
+ cat = Category.objects.filter(pk__in=cat_id).translated(get_language()).order_by("translations__name")
for obj in cat:
yield str(obj.pk), smart_str(obj)
@@ -83,8 +75,6 @@ def choices(self, changelist):
for lookup, title in self.lookup_choices:
yield {
"selected": self.value() == str(lookup),
- "query_string": changelist.get_query_string(
- {self.parameter_name: lookup}
- ),
+ "query_string": changelist.get_query_string({self.parameter_name: lookup}),
"display": title,
}
diff --git a/djangocms_alias/forms.py b/djangocms_alias/forms.py
index d8e1ae42..afc1f886 100644
--- a/djangocms_alias/forms.py
+++ b/djangocms_alias/forms.py
@@ -75,9 +75,7 @@ def clean(self):
placeholder = cleaned_data.get("placeholder")
if not plugin and not placeholder:
- raise forms.ValidationError(
- _("A plugin or placeholder is required to create an alias.")
- )
+ raise forms.ValidationError(_("A plugin or placeholder is required to create an alias."))
if plugin and placeholder:
raise forms.ValidationError(
@@ -125,9 +123,7 @@ def clean(self):
language=cleaned_data.get("language"),
alias__category=cleaned_data.get("category"),
).exists():
- raise forms.ValidationError(
- _("Alias with this Name and Category already exists.")
- )
+ raise forms.ValidationError(_("Alias with this Name and Category already exists."))
return cleaned_data
@@ -177,9 +173,7 @@ def save(self):
class CreateAliasWizardForm(forms.Form):
- name = forms.CharField(
- label=_("Name"), required=True, widget=AdminTextInputWidget()
- )
+ name = forms.CharField(label=_("Name"), required=True, widget=AdminTextInputWidget())
site = forms.ModelChoiceField(
queryset=Site.objects.all(),
required=False,
@@ -276,9 +270,7 @@ class AliasPluginForm(forms.ModelForm):
queryset=Category.objects.all(),
widget=CategorySelectWidget(
attrs={
- "data-placeholder": _(
- "Select category to restrict the list of aliases below"
- ), # noqa: E501
+ "data-placeholder": _("Select category to restrict the list of aliases below"), # noqa: E501
},
),
empty_label="",
@@ -334,8 +326,6 @@ def clean(self):
language=cleaned_data.get("language"),
alias__category=cleaned_data.get("category"),
).exists():
- raise forms.ValidationError(
- _("Alias with this Name and Category already exists.")
- )
+ raise forms.ValidationError(_("Alias with this Name and Category already exists."))
return cleaned_data
diff --git a/djangocms_alias/migrations/0001_initial.py b/djangocms_alias/migrations/0001_initial.py
index 6111d966..1867163d 100644
--- a/djangocms_alias/migrations/0001_initial.py
+++ b/djangocms_alias/migrations/0001_initial.py
@@ -148,9 +148,7 @@ class Migration(migrations.Migration):
),
(
"language_code",
- models.CharField(
- db_index=True, max_length=15, verbose_name="Language"
- ),
+ models.CharField(db_index=True, max_length=15, verbose_name="Language"),
),
(
"name",
diff --git a/djangocms_alias/migrations/0004_alter_aliascontent_language.py b/djangocms_alias/migrations/0004_alter_aliascontent_language.py
index 21b2f2fd..a8ef3da6 100644
--- a/djangocms_alias/migrations/0004_alter_aliascontent_language.py
+++ b/djangocms_alias/migrations/0004_alter_aliascontent_language.py
@@ -13,8 +13,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="aliascontent",
name="language",
- field=models.CharField(
- default=django.utils.translation.get_language, max_length=10
- ),
+ field=models.CharField(default=django.utils.translation.get_language, max_length=10),
),
]
diff --git a/djangocms_alias/models.py b/djangocms_alias/models.py
index 76c20f15..f9190817 100644
--- a/djangocms_alias/models.py
+++ b/djangocms_alias/models.py
@@ -104,9 +104,7 @@ class Meta:
verbose_name = _("alias")
verbose_name_plural = _("aliases")
ordering = ["position"]
- unique_together = (
- ("static_code", "site"),
- ) # Only restrict instances that have a site specified
+ unique_together = (("static_code", "site"),) # Only restrict instances that have a site specified
def __init__(self, *args, **kwargs):
self._plugins_cache = {}
@@ -130,9 +128,7 @@ def is_in_use(self):
def objects_using(self):
objects = set()
object_ids = defaultdict(set)
- plugins = self.cms_plugins.select_related("placeholder").prefetch_related(
- "placeholder__source"
- )
+ plugins = self.cms_plugins.select_related("placeholder").prefetch_related("placeholder__source")
for plugin in plugins:
obj = plugin.placeholder.source
obj_class_name = obj.__class__.__name__
@@ -147,11 +143,7 @@ def objects_using(self):
else:
objects.update([obj])
objects.update(
- [
- obj
- for model_class, ids in object_ids.items()
- for obj in model_class.objects.filter(pk__in=ids)
- ]
+ [obj for model_class, ids in object_ids.items() for obj in model_class.objects.filter(pk__in=ids)]
)
return list(objects)
@@ -202,9 +194,7 @@ def get_content(self, language=None, show_draft_content=False):
return self._content_cache[language]
def get_placeholder(self, language=None, show_draft_content=False):
- content = self.get_content(
- language=language, show_draft_content=show_draft_content
- )
+ content = self.get_content(language=language, show_draft_content=show_draft_content)
return getattr(content, "placeholder", None)
def get_plugins(self, language=None):
@@ -427,7 +417,5 @@ def is_recursive(self, language=None):
plugins = AliasPlugin.objects.filter(
placeholder_id=placeholder,
)
- plugins = plugins.filter(
- Q(pk=self) | Q(alias__contents__placeholders=placeholder)
- )
+ plugins = plugins.filter(Q(pk=self) | Q(alias__contents__placeholders=placeholder))
return plugins.exists()
diff --git a/djangocms_alias/templatetags/djangocms_alias_tags.py b/djangocms_alias/templatetags/djangocms_alias_tags.py
index b6f5c985..d0f04d6f 100644
--- a/djangocms_alias/templatetags/djangocms_alias_tags.py
+++ b/djangocms_alias/templatetags/djangocms_alias_tags.py
@@ -107,13 +107,9 @@ def _get_alias(self, request, static_code, extra_bits):
return None
# Parler's get_or_create doesn't work well with translations, so we must perform our own get or create
- default_category = Category.objects.filter(
- translations__name=DEFAULT_STATIC_ALIAS_CATEGORY_NAME
- ).first()
+ default_category = Category.objects.filter(translations__name=DEFAULT_STATIC_ALIAS_CATEGORY_NAME).first()
if not default_category:
- default_category = Category.objects.create(
- name=DEFAULT_STATIC_ALIAS_CATEGORY_NAME
- )
+ default_category = Category.objects.create(name=DEFAULT_STATIC_ALIAS_CATEGORY_NAME)
alias_creation_kwargs = {
"static_code": static_code,
@@ -123,13 +119,9 @@ def _get_alias(self, request, static_code, extra_bits):
if "site" in extra_bits:
alias_creation_kwargs["site"] = current_site
- alias = Alias.objects.create(
- category=default_category, **alias_creation_kwargs
- )
+ alias = Alias.objects.create(category=default_category, **alias_creation_kwargs)
- if not AliasContent._base_manager.filter(
- alias=alias, language=language
- ).exists():
+ if not AliasContent._base_manager.filter(alias=alias, language=language).exists():
# Create a first content object if none exists in the given language.
# If versioning is enabled we can only create the records with a logged-in user / staff member
if is_versioning_enabled() and not request.user.is_authenticated:
@@ -174,9 +166,7 @@ def render_tag(self, context, static_code, extra_bits, nodelist=None):
get_draft_content = True
language = get_language_from_request(request)
- placeholder = alias.get_placeholder(
- language=language, show_draft_content=get_draft_content
- )
+ placeholder = alias.get_placeholder(language=language, show_draft_content=get_draft_content)
if placeholder:
content = renderer.render_placeholder(
diff --git a/djangocms_alias/views.py b/djangocms_alias/views.py
index 805cc476..068ac760 100644
--- a/djangocms_alias/views.py
+++ b/djangocms_alias/views.py
@@ -145,9 +145,7 @@ def create_alias_view(request):
return HttpResponse(JAVASCRIPT_SUCCESS_RESPONSE)
-def render_replace_response(
- request, new_plugins, source_placeholder=None, source_plugin=None
-):
+def render_replace_response(request, new_plugins, source_placeholder=None, source_plugin=None):
move_plugins, add_plugins = [], []
for plugin in new_plugins:
root = plugin.parent.get_bound_plugin() if plugin.parent else plugin
diff --git a/pyproject.toml b/pyproject.toml
index a10167bc..63c8c966 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,6 @@
+[tool.ruff]
+line-length = 119
+
[tool.ruff.lint]
select=[
"E", # pycodestyle errors
@@ -10,14 +13,15 @@ select=[
"PLR", # pylint refactor
"PLW", # pylint warning
"UP", # pyupgrade
+
]
extend-ignore = [
- "PLR0915",
- "C901",
- "PLR0913",
- "PLW1510",
- "I001" ,
- "PLR0912" ,
- "E501"
+ "C901", # Too complex
+ "PLR0911", # Too many return statements
+ "PLR0912", # Too many branches
+ "PLR0913", # Too many arguments to function call
+ "PLR0915", # Too many statements
+ # TODO
+ "PLW1510" # subprocess.run without explicit argument
]
diff --git a/tests/base.py b/tests/base.py
index 3a3061b3..dfd53dc0 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -63,9 +63,7 @@ def setUp(self):
self.category = Category.objects.create(name="test category")
def _get_draft_page_placeholder(self):
- page_content = create_page_content(
- self.language, "Draft Page", self.page, created_by=self.superuser
- )
+ page_content = create_page_content(self.language, "Draft Page", self.page, created_by=self.superuser)
return page_content.get_placeholders().get(slot="content")
def _create_alias(
@@ -100,9 +98,7 @@ def _create_alias(
if is_versioning_enabled():
from djangocms_versioning.models import Version
- version = Version.objects.create(
- content=alias_content, created_by=self.superuser
- )
+ version = Version.objects.create(content=alias_content, created_by=self.superuser)
if published:
version.publish(self.superuser)
@@ -115,14 +111,9 @@ def _get_version(self, grouper, version_state, language=None):
from djangocms_versioning.models import Version
- versions = Version.objects.filter_by_grouper(grouper).filter(
- state=version_state
- )
+ versions = Version.objects.filter_by_grouper(grouper).filter(state=version_state)
for version in versions:
- if (
- hasattr(version.content, "language")
- and version.content.language == language
- ):
+ if hasattr(version.content, "language") and version.content.language == language:
return version
def _publish(self, grouper, language=None):
@@ -161,9 +152,7 @@ def _create_page(self, title, language=None, site=None, published=True, **kwargs
def get_alias_request(self, alias, lang_code="en", *args, **kwargs):
request = self._get_instance_request(alias, *args, **kwargs)
request.current_page = None
- request = self._process_request_by_toolbar_middleware(
- request, obj=alias.get_content(lang_code)
- )
+ request = self._process_request_by_toolbar_middleware(request, obj=alias.get_content(lang_code))
return request
def get_page_request(self, page, obj=None, *args, **kwargs):
@@ -239,23 +228,11 @@ def add_alias_plugin_to_page(self, page, alias, language=None):
def get_staff_user_with_alias_permissions(self):
staff_user = self._create_user("alias staff", is_staff=True, is_superuser=False) # noqa: E501
- self.add_permission(
- staff_user, get_permission_codename("add", AliasModel._meta)
- ) # noqa: E501
- self.add_permission(
- staff_user, get_permission_codename("change", AliasModel._meta)
- ) # noqa: E501
- self.add_permission(
- staff_user, get_permission_codename("delete", AliasModel._meta)
- ) # noqa: E501
- self.add_permission(
- staff_user, get_permission_codename("add", AliasContent._meta)
- ) # noqa: E501
- self.add_permission(
- staff_user, get_permission_codename("change", AliasContent._meta)
- ) # noqa: E501
- self.add_permission(
- staff_user, get_permission_codename("delete", AliasContent._meta)
- ) # noqa: E501
+ self.add_permission(staff_user, get_permission_codename("add", AliasModel._meta)) # noqa: E501
+ self.add_permission(staff_user, get_permission_codename("change", AliasModel._meta)) # noqa: E501
+ self.add_permission(staff_user, get_permission_codename("delete", AliasModel._meta)) # noqa: E501
+ self.add_permission(staff_user, get_permission_codename("add", AliasContent._meta)) # noqa: E501
+ self.add_permission(staff_user, get_permission_codename("change", AliasContent._meta)) # noqa: E501
+ self.add_permission(staff_user, get_permission_codename("delete", AliasContent._meta)) # noqa: E501
self.add_permission(staff_user, get_permission_codename("add", Category._meta)) # noqa: E501
return staff_user
diff --git a/tests/test_admin.py b/tests/test_admin.py
index fc9bf57f..d1a16ca4 100644
--- a/tests/test_admin.py
+++ b/tests/test_admin.py
@@ -66,14 +66,9 @@ def test_alias_content_manager_rendering_without_versioning_actions(self):
response_content_decoded,
)
- usage_url = admin_reverse(
- USAGE_ALIAS_URL_NAME, args=[expected_en_content.alias.pk]
- )
+ usage_url = admin_reverse(USAGE_ALIAS_URL_NAME, args=[expected_en_content.alias.pk])
change_category_and_site_url = admin_reverse(
- "{}_{}_change".format(
- expected_en_content._meta.app_label,
- expected_en_content.alias._meta.model_name,
- ),
+ f"{expected_en_content._meta.app_label}_{expected_en_content.alias._meta.model_name}_change",
args=(expected_en_content.alias.pk,),
)
@@ -87,10 +82,7 @@ def test_alias_content_manager_rendering_without_versioning_actions(self):
)
# check for add content admin link
add_alias_link = admin_reverse(
- "{}_{}_add".format(
- expected_en_content._meta.app_label,
- expected_en_content._meta.model_name,
- )
+ f"{expected_en_content._meta.app_label}_{expected_en_content._meta.model_name}_add"
)
self.assertNotIn(
# It is not currently possible to add an alias from the django admin changelist issue #97
@@ -174,14 +166,9 @@ def test_alias_changelist_rendering_with_versioning_actions(self):
response_content_decoded,
)
- usage_url = admin_reverse(
- USAGE_ALIAS_URL_NAME, args=[expected_en_content.alias.pk]
- )
+ usage_url = admin_reverse(USAGE_ALIAS_URL_NAME, args=[expected_en_content.alias.pk])
settings_url = admin_reverse(
- "{}_{}_change".format(
- expected_en_content._meta.app_label,
- expected_en_content.alias._meta.model_name,
- ),
+ f"{expected_en_content._meta.app_label}_{expected_en_content.alias._meta.model_name}_change",
args=(expected_en_content.alias.pk,),
)
@@ -230,10 +217,7 @@ def test_alias_content_manager_rendering_preview_add_url(self):
)
# check for add content admin link
add_aliascontent_url = admin_reverse(
- "{}_{}_add".format(
- expected_en_content._meta.app_label,
- expected_en_content._meta.model_name,
- )
+ f"{expected_en_content._meta.app_label}_{expected_en_content._meta.model_name}_add"
)
self.assertNotIn(
add_aliascontent_url,
@@ -245,9 +229,7 @@ def _create_alias_and_categories(self, category_name, alias_content_name=None):
alias_content_name = category_name
category = Category.objects.create(name=category_name)
alias = AliasModel.objects.create(category=category, position=0)
- alias_content = AliasContent.objects.create(
- alias=alias, name=alias_content_name, language="en"
- )
+ alias_content = AliasContent.objects.create(alias=alias, name=alias_content_name, language="en")
return category, alias, alias_content
@skipUnless(is_versioning_enabled(), "Test only relevant for versioning")
@@ -287,13 +269,9 @@ def test_category_field_ordering_versioned(self):
from djangocms_versioning.models import Version
Version.objects.create(content=first_alias_content, created_by=self.superuser)
- Version.objects.create(
- content=first_alias_content_lower, created_by=self.superuser
- )
+ Version.objects.create(content=first_alias_content_lower, created_by=self.superuser)
Version.objects.create(content=middle_alias_content, created_by=self.superuser)
- Version.objects.create(
- content=last_alias_content_lower, created_by=self.superuser
- )
+ Version.objects.create(content=last_alias_content_lower, created_by=self.superuser)
Version.objects.create(content=last_alias_content, created_by=self.superuser)
with self.login_user_context(self.superuser):
@@ -460,15 +438,9 @@ def test_aliascontent_list_view(self):
alias1_content = alias1.get_content(language=self.language)
alias2_content = alias2.get_content(language=self.language)
alias3_content = alias3.get_content(language=self.language)
- aliascontent1_url = admin_reverse(
- CHANGE_ALIAS_URL_NAME, args=[alias1_content.pk]
- )
- aliascontent2_url = admin_reverse(
- CHANGE_ALIAS_URL_NAME, args=[alias2_content.pk]
- )
- aliascontent3_url = admin_reverse(
- CHANGE_ALIAS_URL_NAME, args=[alias3_content.pk]
- )
+ aliascontent1_url = admin_reverse(CHANGE_ALIAS_URL_NAME, args=[alias1_content.pk])
+ aliascontent2_url = admin_reverse(CHANGE_ALIAS_URL_NAME, args=[alias2_content.pk])
+ aliascontent3_url = admin_reverse(CHANGE_ALIAS_URL_NAME, args=[alias3_content.pk])
self.assertContains(response, aliascontent1_url)
self.assertContains(response, aliascontent2_url)
@@ -537,9 +509,7 @@ def test_changelist_staff_user_without_permission(self):
def test_changelist_staff_user_with_permission(self):
user = self.get_staff_user_with_std_permissions()
user.user_permissions.add(
- Permission.objects.get(
- content_type__app_label="djangocms_alias", codename="change_category"
- )
+ Permission.objects.get(content_type__app_label="djangocms_alias", codename="change_category")
)
with self.login_user_context(user):
response = self.client.get(self.get_category_list_endpoint())
@@ -549,9 +519,7 @@ def test_changelist_edit_button(self):
with self.login_user_context(self.superuser):
response = self.client.get(self.get_category_list_endpoint())
- self.assertContains(
- response, '
' "Alias contents"
+ )
expected_content = '
Aliases | '
self.assertEqual(response.status_code, 200)
diff --git a/tests/test_admin_filters.py b/tests/test_admin_filters.py
index 54e905b2..6934b14b 100644
--- a/tests/test_admin_filters.py
+++ b/tests/test_admin_filters.py
@@ -57,15 +57,9 @@ def test_site_filter(self):
if is_versioning_enabled():
from djangocms_versioning.models import Version
- Version.objects.create(
- content=current_site_alias_content, created_by=self.superuser
- )
- Version.objects.create(
- content=another_site_alias_content, created_by=self.superuser
- )
- Version.objects.create(
- content=no_site_alias_content, created_by=self.superuser
- )
+ Version.objects.create(content=current_site_alias_content, created_by=self.superuser)
+ Version.objects.create(content=another_site_alias_content, created_by=self.superuser)
+ Version.objects.create(content=no_site_alias_content, created_by=self.superuser)
base_url = self.get_admin_url(AliasModel, "changelist")
@@ -73,21 +67,13 @@ def test_site_filter(self):
# en is the default language configured for the site
response_default = self.client.get(base_url)
# filter by aliases with the current site
- response_current_site = self.client.get(
- f"{base_url}?{SITE_FILTER_URL_PARAM}={current_site.pk}"
- )
+ response_current_site = self.client.get(f"{base_url}?{SITE_FILTER_URL_PARAM}={current_site.pk}")
# filter by aliases with a different site set
- response_other_site = self.client.get(
- f"{base_url}?{SITE_FILTER_URL_PARAM}={another_site.pk}"
- )
+ response_other_site = self.client.get(f"{base_url}?{SITE_FILTER_URL_PARAM}={another_site.pk}")
# filter by aliases with an empty site set
- response_empty_site = self.client.get(
- f"{base_url}?{SITE_FILTER_URL_PARAM}={empty_site.pk}"
- )
+ response_empty_site = self.client.get(f"{base_url}?{SITE_FILTER_URL_PARAM}={empty_site.pk}")
# filter by aliases with no site set
- response_no_site = self.client.get(
- f"{base_url}?{SITE_FILTER_URL_PARAM}={SITE_FILTER_NO_SITE_VALUE}"
- )
+ response_no_site = self.client.get(f"{base_url}?{SITE_FILTER_URL_PARAM}={SITE_FILTER_NO_SITE_VALUE}")
# By default, all alias are shown
self.assertEqual(
@@ -99,13 +85,9 @@ def test_site_filter(self):
},
)
# Only alias attached to the current site are shown when filtered by the current site
- self.assertEqual(
- set(response_current_site.context["cl"].queryset), {current_site_alias}
- )
+ self.assertEqual(set(response_current_site.context["cl"].queryset), {current_site_alias})
# Only alias attached to the current site are shown when filtered by another site
- self.assertEqual(
- set(response_other_site.context["cl"].queryset), {another_site_alias}
- )
+ self.assertEqual(set(response_other_site.context["cl"].queryset), {another_site_alias})
# Only alias attached to the current site are shown when filtered by no site
self.assertEqual(set(response_no_site.context["cl"].queryset), {no_site_alias})
# No are shown when filtered by an empty site
@@ -144,13 +126,9 @@ def test_category_filter_no_verisoning(self):
with self.login_user_context(self.superuser):
response_default = self.client.get(base_url)
# category one should have a result
- category_one_filter_response = self.client.get(
- f"{base_url}?category={category_one.id}"
- )
+ category_one_filter_response = self.client.get(f"{base_url}?category={category_one.id}")
# category two should have a result
- category_two_filter_response = self.client.get(
- f"{base_url}?category={category_two.id}"
- )
+ category_two_filter_response = self.client.get(f"{base_url}?category={category_two.id}")
# By default all alias contents are shown
self.assertEqual(
@@ -189,9 +167,7 @@ def test_category_filter_with_verisoning(self):
name="EN Alias Content one",
language="en",
)
- Version.objects.create(
- content=expected_category_one_content, created_by=self.superuser
- )
+ Version.objects.create(content=expected_category_one_content, created_by=self.superuser)
category_two = Category.objects.create(name="two")
alias_two = AliasModel.objects.create(
category=category_two,
@@ -202,21 +178,15 @@ def test_category_filter_with_verisoning(self):
name="EN Alias Content two",
language="en",
)
- Version.objects.create(
- content=expected_category_two_content, created_by=self.superuser
- )
+ Version.objects.create(content=expected_category_two_content, created_by=self.superuser)
base_url = self.get_admin_url(AliasModel, "changelist")
with self.login_user_context(self.superuser):
response_default = self.client.get(base_url)
# category one should have a result
- category_one_filter_response = self.client.get(
- f"{base_url}?category={category_one.id}"
- )
+ category_one_filter_response = self.client.get(f"{base_url}?category={category_one.id}")
# categopry two should have a result
- category_two_filter_response = self.client.get(
- f"{base_url}?category={category_two.id}"
- )
+ category_two_filter_response = self.client.get(f"{base_url}?category={category_two.id}")
# By default, all alias contents are shown
self.assertEqual(
@@ -227,13 +197,9 @@ def test_category_filter_with_verisoning(self):
},
)
# show alias contents filter by category one
- self.assertEqual(
- set(category_one_filter_response.context["cl"].queryset), {alias_one}
- )
+ self.assertEqual(set(category_one_filter_response.context["cl"].queryset), {alias_one})
# show alias contents filter by category two
- self.assertEqual(
- set(category_two_filter_response.context["cl"].queryset), {alias_two}
- )
+ self.assertEqual(set(category_two_filter_response.context["cl"].queryset), {alias_two})
def test_category_filter_lookups_ordered_alphabetical(self):
"""
@@ -261,9 +227,7 @@ def test_category_filter_lookups_ordered_alphabetical(self):
)
version_admin = admin.site._registry[AliasModel]
- category_filter = CategoryFilter(
- None, {"category": [""]}, AliasModel, version_admin
- )
+ category_filter = CategoryFilter(None, {"category": [""]}, AliasModel, version_admin)
# Get the first choice in the filter lookup object
first_lookup_value = category_filter.lookup_choices[0][1]
# Lookup value should match the category name linked to alias content
@@ -292,9 +256,7 @@ def test_category_filter_lookup_should_only_show_aliases_linked_to_content(self)
category_two = Category.objects.create(name="a - category")
version_admin = admin.site._registry[AliasModel]
- category_filter = CategoryFilter(
- None, {"category": [""]}, AliasModel, version_admin
- )
+ category_filter = CategoryFilter(None, {"category": [""]}, AliasModel, version_admin)
# Get the first choice in the filter lookup object
first_lookup_value = category_filter.lookup_choices[0][1]
diff --git a/tests/test_cms_plugins.py b/tests/test_cms_plugins.py
index 2195d2e8..7a69e354 100644
--- a/tests/test_cms_plugins.py
+++ b/tests/test_cms_plugins.py
@@ -36,18 +36,14 @@ def test_extra_plugin_items_for_alias_plugins(self):
page_content = None
if is_versioning_enabled():
# Can only edit page/content that is in DRAFT
- page_content = create_title(
- self.language, "Draft Page", self.page, created_by=self.superuser
- )
+ page_content = create_title(self.language, "Draft Page", self.page, created_by=self.superuser)
placeholder = page_content.get_placeholders().get(slot="content")
alias_plugin = alias.get_content(self.language).populate(
replaced_placeholder=placeholder,
)
extra_items = Alias.get_extra_plugin_menu_items(
- self.get_page_request(
- page=self.page, obj=page_content, user=self.superuser
- ),
+ self.get_page_request(page=self.page, obj=page_content, user=self.superuser),
alias_plugin,
)
@@ -260,10 +256,7 @@ def test_create_alias_from_plugin_list(self):
)
self.assertEqual(
plugins[0].get_bound_plugin().body,
- alias.get_placeholder(self.language)
- .get_plugins()[0]
- .get_bound_plugin()
- .body,
+ alias.get_placeholder(self.language).get_plugins()[0].get_bound_plugin().body,
)
def test_replace_plugin_with_alias(self):
@@ -278,9 +271,7 @@ def test_replace_plugin_with_alias(self):
plugins,
)
self.assertEqual(plugins[0].get_bound_plugin(), alias_plugin)
- self.assertEqual(
- alias_content.placeholder.get_plugins()[0].get_bound_plugin().body, "test"
- ) # noqa: E501
+ self.assertEqual(alias_content.placeholder.get_plugins()[0].get_bound_plugin().body, "test") # noqa: E501
def test_replace_plugin_with_alias_correct_position(self):
second_plugin = add_plugin(
@@ -296,9 +287,7 @@ def test_replace_plugin_with_alias_correct_position(self):
body="test 3",
)
alias = self._create_alias()
- alias_plugin = alias.get_content(self.language).populate(
- replaced_plugin=second_plugin
- )
+ alias_plugin = alias.get_content(self.language).populate(replaced_plugin=second_plugin)
plugins = self.placeholder.get_plugins()
self.assertNotIn(
self.plugin,
diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py
index f1baf94a..73f52480 100644
--- a/tests/test_templatetags.py
+++ b/tests/test_templatetags.py
@@ -15,9 +15,7 @@
class AliasTemplateTagsTestCase(BaseAliasPluginTestCase):
- alias_template = (
- """{% load djangocms_alias_tags %}{% render_alias plugin.alias %}""" # noqa: E501
- )
+ alias_template = """{% load djangocms_alias_tags %}{% render_alias plugin.alias %}""" # noqa: E501
def test_render_alias(self):
alias = self._create_alias()
@@ -83,9 +81,7 @@ def test_render_alias_dont_render_draft_aliases(self):
class AliasTemplateTagAliasPlaceholderTestCase(BaseAliasPluginTestCase):
- alias_template = (
- """{% load djangocms_alias_tags %}{% static_alias "some_unique_id" %}""" # noqa: E501
- )
+ alias_template = """{% load djangocms_alias_tags %}{% static_alias "some_unique_id" %}""" # noqa: E501
def test_no_alias_rendered_when_no_alias_exists(self):
alias = self._create_alias(static_code="")
@@ -141,9 +137,7 @@ def test_alias_auto_creation_in_template(self):
alias_template = """{% load djangocms_alias_tags %}{% static_alias "category_unique_code" %}""" # noqa: E501
# No Alias or Category exist
- category = Category.objects.filter(
- translations__name=DEFAULT_STATIC_ALIAS_CATEGORY_NAME
- )
+ category = Category.objects.filter(translations__name=DEFAULT_STATIC_ALIAS_CATEGORY_NAME)
alias = AliasModel.objects.filter(static_code="category_unique_code")
self.assertEqual(category.count(), 0)
@@ -174,9 +168,7 @@ def test_alias_auto_creation_in_template_site_limited_alias(self):
When a template discovers a static code for a site and with no site with the same static_code
entries are created for both scenarios
"""
- unlimited_template = (
- """{% load djangocms_alias_tags %}{% static_alias "limited_alias_code" %}""" # noqa: E501
- )
+ unlimited_template = """{% load djangocms_alias_tags %}{% static_alias "limited_alias_code" %}""" # noqa: E501
site_limited_template = """{% load djangocms_alias_tags %}{% static_alias "limited_alias_code" site %}""" # noqa: E501
site_id = 1
@@ -242,24 +234,16 @@ def test_site_limited_alias_displays_the_correct_contents(self):
# Should show the contents of the unlimited template
with override_settings(SITE_ID=site1.pk):
- site1_unlimited_preview = self.render_template_obj(
- unlimited_template, {}, self.get_request("/")
- )
- site1_limited_preview = self.render_template_obj(
- site_limited_template, {}, self.get_request("/")
- )
+ site1_unlimited_preview = self.render_template_obj(unlimited_template, {}, self.get_request("/"))
+ site1_limited_preview = self.render_template_obj(site_limited_template, {}, self.get_request("/"))
self.assertEqual(site1_unlimited_preview, "unlimited text")
self.assertEqual(site1_limited_preview, "")
# Should show the contents of the site limited template
with override_settings(SITE_ID=site2.pk):
- site2_unlimited_preview = self.render_template_obj(
- unlimited_template, {}, self.get_request("/")
- )
- site2_limited_preview = self.render_template_obj(
- site_limited_template, {}, self.get_request("/")
- )
+ site2_unlimited_preview = self.render_template_obj(unlimited_template, {}, self.get_request("/"))
+ site2_limited_preview = self.render_template_obj(site_limited_template, {}, self.get_request("/"))
self.assertEqual(site2_unlimited_preview, "unlimited text")
self.assertEqual(site2_limited_preview, "site limited text")
@@ -318,9 +302,7 @@ def test_static_alias_shows_correct_content_for_versioning_states(self):
# The live page should still contain the published contents
live_response = self.client.get(page_live_url)
- self.assertContains(
- live_response, "Published content for: template_example_global_alias_code"
- )
+ self.assertContains(live_response, "Published content for: template_example_global_alias_code")
self.assertNotContains(
live_response,
"Updated Draft content for: template_example_global_alias_code",
@@ -372,19 +354,11 @@ def page_edit_url(lang):
return get_object_edit_url(page.get_content_obj(lang), language=lang)
with self.login_user_context(self.superuser):
- self.client.get(
- page_edit_url("en"), follow=True
- ) # supposed to create the alias and alias content for en
- self.client.get(
- page_edit_url("en"), follow=True
- ) # supposed to create no additional object
- self.client.get(
- page_edit_url("de"), follow=True
- ) # supposed to create the alias content for de
-
- alias = AliasModel.objects.filter(
- static_code="template_example_global_alias_code"
- ).first()
+ self.client.get(page_edit_url("en"), follow=True) # supposed to create the alias and alias content for en
+ self.client.get(page_edit_url("en"), follow=True) # supposed to create no additional object
+ self.client.get(page_edit_url("de"), follow=True) # supposed to create the alias content for de
+
+ alias = AliasModel.objects.filter(static_code="template_example_global_alias_code").first()
self.assertIsNotNone(alias, "Alias not created")
self.assertIsNotNone(alias.get_content("en", show_draft_content=True))
@@ -393,9 +367,7 @@ def page_edit_url(lang):
self.assertEqual(alias.contents(manager="admin_manager").count(), 2)
def test_alias_rendered_when_identifier_is_variable(self):
- alias_template = (
- """{% load djangocms_alias_tags %}{% static_alias foo_variable %}""" # noqa: E501
- )
+ alias_template = """{% load djangocms_alias_tags %}{% static_alias foo_variable %}""" # noqa: E501
alias = self._create_alias(static_code="some_unique_id")
add_plugin(
diff --git a/tests/test_toolbar.py b/tests/test_toolbar.py
index 6f633df0..b46b0879 100644
--- a/tests/test_toolbar.py
+++ b/tests/test_toolbar.py
@@ -24,9 +24,7 @@
class AliasToolbarTestCase(BaseAliasPluginTestCase):
def _get_wizard_create_button(self, request):
- button_lists = [
- result.item for result in request.toolbar.find_items(item_type=ButtonList)
- ]
+ button_lists = [result.item for result in request.toolbar.find_items(item_type=ButtonList)]
buttons = list(
# flatten the list
itertools.chain.from_iterable([item.buttons for item in button_lists])
@@ -43,9 +41,7 @@ def test_add_aliases_submenu_to_admin_menu_no_permission(self):
def test_add_aliases_submenu_to_admin_menu(self):
user = self.get_staff_user_with_std_permissions()
user.user_permissions.add(
- Permission.objects.get(
- content_type__app_label="djangocms_alias", codename="change_category"
- )
+ Permission.objects.get(content_type__app_label="djangocms_alias", codename="change_category")
)
try:
page_url = get_object_edit_url(self.page.get_title_obj(self.language))
@@ -69,9 +65,7 @@ def test_add_alias_menu_showing_only_on_alias_plugin_views(self):
self.get_list_alias_endpoint(),
self.page.get_absolute_url(language=self.language),
]:
- request = self.get_page_request(
- page=None, path=endpoint, user=self.superuser
- )
+ request = self.get_page_request(page=None, path=endpoint, user=self.superuser)
alias_menu = request.toolbar.get_menu(ALIAS_MENU_IDENTIFIER)
self.assertEqual(alias_menu, None)
@@ -125,8 +119,7 @@ def test_alias_toolbar_language_menu(self):
self.assertEqual(language_menu.get_item_count(), 4)
language_menu_dict = {
- menu.name: [menu_item.name for menu_item in menu.items]
- for key, menu in language_menu.menus.items()
+ menu.name: [menu_item.name for menu_item in menu.items] for key, menu in language_menu.menus.items()
}
self.assertIn("Add Translation", language_menu_dict.keys())
self.assertIn("Delete Translation", language_menu_dict.keys())
@@ -147,9 +140,7 @@ def test_alias_toolbar_language_menu(self):
from djangocms_versioning.constants import PUBLISHED
from djangocms_versioning.models import Version
- Version.objects.create(
- content=alias_content, created_by=self.superuser, state=PUBLISHED
- )
+ Version.objects.create(content=alias_content, created_by=self.superuser, state=PUBLISHED)
request = self.get_alias_request(
alias=alias,
@@ -160,8 +151,7 @@ def test_alias_toolbar_language_menu(self):
self.assertEqual(language_menu.get_item_count(), 6)
language_menu_dict = {
- menu.name: [menu_item.name for menu_item in menu.items]
- for key, menu in language_menu.menus.items()
+ menu.name: [menu_item.name for menu_item in menu.items] for key, menu in language_menu.menus.items()
}
self.assertEqual(
{"Deutsche...", "Italiano..."},
@@ -178,8 +168,7 @@ def test_alias_toolbar_language_menu(self):
language_menu_first_items = {
menu.name: next(
filter(
- lambda item: item.name
- in ["Française...", "Deutsche...", "from Française"],
+ lambda item: item.name in ["Française...", "Deutsche...", "from Française"],
menu.items,
)
)
@@ -219,9 +208,7 @@ def test_language_switcher_when_toolbar_object_is_alias_content(self):
from djangocms_versioning.constants import DRAFT
from djangocms_versioning.models import Version
- Version.objects.create(
- content=alias_content, created_by=self.superuser, state=DRAFT
- )
+ Version.objects.create(content=alias_content, created_by=self.superuser, state=DRAFT)
alias_content.populate(replaced_placeholder=self.placeholder)
alias_content.alias.clear_cache()
@@ -273,9 +260,7 @@ def test_page_toolbar_no_language_menu(self):
break
else:
self.fail("No AliasToolbar in alias request")
- language_menu = request.toolbar.get_menu(
- LANGUAGE_MENU_IDENTIFIER, _("Language")
- )
+ language_menu = request.toolbar.get_menu(LANGUAGE_MENU_IDENTIFIER, _("Language"))
self.assertIsNone(language_menu)
def test_change_alias_settings_button_is_visible_on_alias_edit_view(self):
@@ -448,8 +433,7 @@ def test_site_dropdown_url_renders_admin_changelist_url(self):
admin_menu = request.toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER)
site_aliases_url = admin_menu.items[3].url
admin_changelist_aliases_url = (
- reverse(f"admin:{AliasContent._meta.app_label}_alias_changelist")
- + "?language=en"
+ reverse(f"admin:{AliasContent._meta.app_label}_alias_changelist") + "?language=en"
)
with self.login_user_context(self.superuser):
diff --git a/tests/test_views.py b/tests/test_views.py
index 18261c95..38f13ef9 100644
--- a/tests/test_views.py
+++ b/tests/test_views.py
@@ -479,9 +479,7 @@ def test_view_aliases_using_site_filter(self):
# when no filtering by site 1 only first object displayed
with self.login_user_context(self.superuser):
with force_language("en"):
- site1_aliases_filter_url = (
- f"{alias_list_url}?site={site1_alias.site.id}"
- )
+ site1_aliases_filter_url = f"{alias_list_url}?site={site1_alias.site.id}"
list_response = self.client.get(site1_aliases_filter_url)
self.assertContains(list_response, site1_alias.name)
@@ -490,9 +488,7 @@ def test_view_aliases_using_site_filter(self):
# when no filtering by site 2 only first object displayed
with self.login_user_context(self.superuser):
with force_language("en"):
- site2_aliases_filter_url = (
- f"{alias_list_url}?site={site2_alias.site.id}"
- )
+ site2_aliases_filter_url = f"{alias_list_url}?site={site2_alias.site.id}"
list_response = self.client.get(site2_aliases_filter_url)
self.assertNotContains(list_response, site1_alias.name)
@@ -548,9 +544,7 @@ def test_select2_view(self):
# This will show because it's a new draft version of the same alias
draft_content = alias2.contents.create(name="foo", language=self.language)
- Version.objects.create(
- content=draft_content, created_by=self.superuser, state=DRAFT
- )
+ Version.objects.create(content=draft_content, created_by=self.superuser, state=DRAFT)
# This shouldn't show because it hasn't content in current language
self._create_alias(name="foo2", language="fr", position=1)
@@ -894,17 +888,11 @@ def test_alias_usage_view(self):
self.assertContains(response, "
Alias | ")
self.assertRegex(
str(response.content),
- r'href="{}"[\w+]?>{}<\/a>'.format(
- re.escape(self.page.get_absolute_url(self.language)),
- str(self.page),
- ),
+ rf'href="{re.escape(self.page.get_absolute_url(self.language))}"[\w+]?>{str(self.page)}<\/a>',
)
self.assertRegex(
str(response.content),
- r'href="{}"[\w+]?>{}<\/a>'.format(
- re.escape(root_alias.get_absolute_url()),
- str(alias),
- ),
+ rf'href="{re.escape(root_alias.get_absolute_url())}"[\w+]?>{str(alias)}<\/a>',
)
self.assertRegex(
str(response.content),
@@ -958,9 +946,7 @@ def test_delete_alias_view_get_using_objects(self):
),
)
self.assertContains(response, "This alias is used by following objects:")
- test = (
- r"
[\s\\n]*Page:[\s\\n]*test<\/a>[\s\\n]*<\/li>"
- )
+ test = r"[\s\\n]*Page:[\s\\n]*test<\/a>[\s\\n]*<\/li>"
self.assertRegex(str(response.content), test)
def test_delete_alias_view_get_alias_not_used_on_any_page(self):
@@ -986,9 +972,7 @@ def test_delete_alias_view_post(self):
),
data={"post": "yes"},
)
- self.assertEqual(
- response.status_code, 302
- ) # Successful delete returns a redirect
+ self.assertEqual(response.status_code, 302) # Successful delete returns a redirect
self.assertFalse(Alias.objects.filter(pk=alias.pk).exists()) # Ensure it's gone
def test_delete_alias_view_user_with_no_perms(self):
@@ -1477,11 +1461,7 @@ def test_alias_not_shown_when_draft_when_visiting_page(self):
is not visible
"""
unpublished_alias = self._create_alias(published=False)
- content = (
- unpublished_alias.contents(manager="admin_manager")
- .filter(language=self.language)
- .first()
- )
+ content = unpublished_alias.contents(manager="admin_manager").filter(language=self.language).first()
alias_placeholder = content.placeholder
body = "unpublished alias"
@@ -1536,13 +1516,9 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
from djangocms_versioning.models import Version
- version_de = Version.objects.create(
- content=alias_content_de, created_by=self.superuser
- )
+ version_de = Version.objects.create(content=alias_content_de, created_by=self.superuser)
version_de.publish(user=self.superuser)
- version_fr = Version.objects.create(
- content=alias_content_fr, created_by=self.superuser
- )
+ version_fr = Version.objects.create(content=alias_content_fr, created_by=self.superuser)
version_fr.publish(user=self.superuser)
with self.login_user_context(self.superuser):
@@ -1550,9 +1526,7 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
# we need to call get_absolute_url on the AliasContent object when versioning is enabled,
# otherwise we are taken to the version list url
- detail_response = self.client.get(
- alias.get_content(language="en").get_absolute_url()
- )
+ detail_response = self.client.get(alias.get_content(language="en").get_absolute_url())
else:
detail_response = self.client.get(alias.get_absolute_url())
list_response = self.client.get(
@@ -1570,9 +1544,7 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
# we need to call get_absolute_url on the AliasContent object when versioning is enabled,
# otherwise we are taken to the version list url
- detail_response = self.client.get(
- alias_content_de.get_absolute_url()
- )
+ detail_response = self.client.get(alias_content_de.get_absolute_url())
else:
detail_response = self.client.get(alias.get_absolute_url())
list_response = self.client.get(
@@ -1590,9 +1562,7 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
# we need to call get_absolute_url on the AliasContent object when versioning is enabled,
# otherwise we are taken to the version list url
- detail_response = self.client.get(
- alias_content_fr.get_absolute_url()
- )
+ detail_response = self.client.get(alias_content_fr.get_absolute_url())
else:
detail_response = self.client.get(alias.get_absolute_url())
list_response = self.client.get(
diff --git a/tests/test_wizards.py b/tests/test_wizards.py
index a74e9013..e8923d51 100644
--- a/tests/test_wizards.py
+++ b/tests/test_wizards.py
@@ -12,11 +12,7 @@
class WizardsTestCase(BaseAliasPluginTestCase):
def _get_wizard_instance(self, wizard_name):
- return [
- wizard
- for wizard in get_wizard_entires()
- if wizard.__class__.__name__ == wizard_name
- ][0]
+ return [wizard for wizard in get_wizard_entires() if wizard.__class__.__name__ == wizard_name][0]
def _get_form_kwargs(self, data, language=None):
language = language or self.language
@@ -35,9 +31,7 @@ def test_create_alias_wizard_instance(self):
self.assertTrue(wizard.user_has_add_permission(self.superuser))
self.assertTrue(
- wizard.user_has_add_permission(
- self.get_staff_user_with_alias_permissions()
- ), # noqa: E501
+ wizard.user_has_add_permission(self.get_staff_user_with_alias_permissions()), # noqa: E501
)
self.assertFalse(
wizard.user_has_add_permission(self.get_staff_user_with_no_permissions()), # noqa: E501
@@ -113,9 +107,7 @@ def test_create_alias_category_wizard_instance(self):
self.assertTrue(wizard.user_has_add_permission(self.superuser))
self.assertTrue(
- wizard.user_has_add_permission(
- self.get_staff_user_with_alias_permissions()
- ), # noqa: E501
+ wizard.user_has_add_permission(self.get_staff_user_with_alias_permissions()), # noqa: E501
)
self.assertFalse(
wizard.user_has_add_permission(self.get_staff_user_with_no_permissions()), # noqa: E501
From 84df2ef1efe4df41f76568e4d8c117d3e8a793c4 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 5 Mar 2024 08:03:45 +0100
Subject: [PATCH 3/3] build(deps): bump es5-ext from 0.10.61 to 0.10.63 (#227)
Bumps [es5-ext](https://github.com/medikoo/es5-ext) from 0.10.61 to 0.10.63.
- [Release notes](https://github.com/medikoo/es5-ext/releases)
- [Changelog](https://github.com/medikoo/es5-ext/blob/main/CHANGELOG.md)
- [Commits](https://github.com/medikoo/es5-ext/compare/v0.10.61...v0.10.63)
---
updated-dependencies:
- dependency-name: es5-ext
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package-lock.json | 69 ++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 63 insertions(+), 6 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 5a04b4c3..f0c20134 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2592,13 +2592,14 @@
}
},
"node_modules/es5-ext": {
- "version": "0.10.61",
- "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz",
- "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==",
+ "version": "0.10.63",
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.63.tgz",
+ "integrity": "sha512-hUCZd2Byj/mNKjfP9jXrdVZ62B8KuA/VoK7X8nUh5qT+AxDmcbvZz041oDVZdbIN1qW6XY9VDNwzkvKnZvK2TQ==",
"hasInstallScript": true,
"dependencies": {
"es6-iterator": "^2.0.3",
"es6-symbol": "^3.1.3",
+ "esniff": "^2.0.1",
"next-tick": "^1.1.0"
},
"engines": {
@@ -2841,6 +2842,25 @@
"node": ">=4"
}
},
+ "node_modules/esniff": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz",
+ "integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==",
+ "dependencies": {
+ "d": "^1.0.1",
+ "es5-ext": "^0.10.62",
+ "event-emitter": "^0.3.5",
+ "type": "^2.7.2"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esniff/node_modules/type": {
+ "version": "2.7.2",
+ "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
+ "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
+ },
"node_modules/espree": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
@@ -2927,6 +2947,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/event-emitter": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
+ "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
+ "dependencies": {
+ "d": "1",
+ "es5-ext": "~0.10.14"
+ }
+ },
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
@@ -10748,12 +10777,13 @@
}
},
"es5-ext": {
- "version": "0.10.61",
- "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz",
- "integrity": "sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA==",
+ "version": "0.10.63",
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.63.tgz",
+ "integrity": "sha512-hUCZd2Byj/mNKjfP9jXrdVZ62B8KuA/VoK7X8nUh5qT+AxDmcbvZz041oDVZdbIN1qW6XY9VDNwzkvKnZvK2TQ==",
"requires": {
"es6-iterator": "^2.0.3",
"es6-symbol": "^3.1.3",
+ "esniff": "^2.0.1",
"next-tick": "^1.1.0"
}
},
@@ -10953,6 +10983,24 @@
"integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true
},
+ "esniff": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz",
+ "integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==",
+ "requires": {
+ "d": "^1.0.1",
+ "es5-ext": "^0.10.62",
+ "event-emitter": "^0.3.5",
+ "type": "^2.7.2"
+ },
+ "dependencies": {
+ "type": {
+ "version": "2.7.2",
+ "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz",
+ "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw=="
+ }
+ }
+ },
"espree": {
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
@@ -11015,6 +11063,15 @@
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
+ "event-emitter": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
+ "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
+ "requires": {
+ "d": "1",
+ "es5-ext": "~0.10.14"
+ }
+ },
"events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",