diff --git a/docs/src/code-style.rst b/docs/src/code-style.rst index 94d32a3a07..5e18298235 100644 --- a/docs/src/code-style.rst +++ b/docs/src/code-style.rst @@ -58,10 +58,13 @@ Run pylint with our developer tool :github-source:`tools/pylint.sh`:: ./tools/pylint.sh -When you think a warning is a false positive, add a comment before the specific line:: +When you think a warning is a false positive, add a comment (see :doc:`pylint:user_guide/messages/message_control`):: - # pylint: disable=unused-argument - def some_function(*args, **kwargs) + def some_function( + something: SomeModel, # pylint: disable=unused-argument + *args, + **kwargs) -> None: + # pylint: disable=too-many-branches .. Note:: diff --git a/docs/src/conf.py b/docs/src/conf.py index 3f257cfbaa..1a08a58986 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -77,6 +77,7 @@ "dateutil": ("https://dateutil.readthedocs.io/en/stable/", None), "geopy": ("https://geopy.readthedocs.io/en/stable/", None), "lxml": ("https://lxml.de/apidoc/", None), + "pylint": ("https://pylint.readthedocs.io/en/latest/", None), "python": ( f"https://docs.python.org/{sys.version_info.major}.{sys.version_info.minor}/", None, diff --git a/integreat_cms/api/middleware/json_debug_toolbar_middleware.py b/integreat_cms/api/middleware/json_debug_toolbar_middleware.py index d80ed2e9b3..dcc36bc40a 100644 --- a/integreat_cms/api/middleware/json_debug_toolbar_middleware.py +++ b/integreat_cms/api/middleware/json_debug_toolbar_middleware.py @@ -17,8 +17,8 @@ from django.http import HttpRequest -# pylint: disable=too-few-public-methods class JsonDebugToolbarMiddleware: + # pylint: disable=too-few-public-methods """ The Django Debug Toolbar usually only works for views that return HTML. This middleware wraps any JSON response in HTML if the request diff --git a/integreat_cms/api/v3/chat/user_chat.py b/integreat_cms/api/v3/chat/user_chat.py index 31c0f27b83..748bca632f 100644 --- a/integreat_cms/api/v3/chat/user_chat.py +++ b/integreat_cms/api/v3/chat/user_chat.py @@ -145,9 +145,10 @@ def send_message( @csrf_exempt @json_response -# pylint: disable=unused-argument def is_chat_enabled_for_user( - request: HttpRequest, region_slug: str, device_id: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + device_id: str, ) -> JsonResponse: """ Function to check if the chat feature is enabled for the given region and the given user. @@ -173,10 +174,9 @@ def is_chat_enabled_for_user( @csrf_exempt @json_response -# pylint: disable=unused-argument def chat( request: HttpRequest, - region_slug: str, + region_slug: str, # pylint: disable=unused-argument language_slug: str, device_id: str, attachment_id: str = "", diff --git a/integreat_cms/api/v3/chat/utils/chat_bot.py b/integreat_cms/api/v3/chat/utils/chat_bot.py index 146bb5a1f4..dddd251650 100644 --- a/integreat_cms/api/v3/chat/utils/chat_bot.py +++ b/integreat_cms/api/v3/chat/utils/chat_bot.py @@ -42,7 +42,7 @@ def automatic_answer(message: str, region: Region, language_slug: str) -> str | f"https://{settings.INTEGREAT_CHAT_BACK_END_DOMAIN}/chatanswers/extract_answer/" ) body = {"message": message, "language": language_slug, "region": region.slug} - r = requests.post(url, json=body, timeout=120) + r = requests.post(url, json=body, timeout=settings.INTEGREAT_CHAT_BACK_END_TIMEOUT) return format_message(r.json()) @@ -58,7 +58,9 @@ def automatic_translation( "source_language": source_language_slug, "target_language": target_language_slug, } - response = requests.post(url, json=body, timeout=120).json() + response = requests.post( + url, json=body, timeout=settings.INTEGREAT_CHAT_BACK_END_TIMEOUT + ).json() if "status" in response and response["status"] == "success": return response["translation"] raise ValueError("Did not receive success response for translation request.") diff --git a/integreat_cms/api/v3/chat/utils/zammad_api.py b/integreat_cms/api/v3/chat/utils/zammad_api.py index 5f49cd3c83..8c475741be 100644 --- a/integreat_cms/api/v3/chat/utils/zammad_api.py +++ b/integreat_cms/api/v3/chat/utils/zammad_api.py @@ -21,8 +21,9 @@ AUTO_ANSWER_STRING = "automatically generated message" -# pylint: disable=unused-argument -def _raise_or_return_json(self: Any, response: HttpResponse) -> dict: +def _raise_or_return_json( + self: Any, response: HttpResponse # pylint: disable=unused-argument +) -> dict: """ Raise HTTPError before converting response to json @@ -37,8 +38,8 @@ def _raise_or_return_json(self: Any, response: HttpResponse) -> dict: return json_value -# pylint: disable=too-many-instance-attributes class ZammadChatAPI: + # pylint: disable=too-many-instance-attributes """ Class providing an API for Zammad used in the context of user chats. @@ -109,8 +110,8 @@ def _parse_response(self, response: dict | list[dict]) -> dict | list[dict]: return {key: response[key] for key in keys_to_keep if key in response} - # pylint: disable=method-hidden def create_ticket(self, device_id: str, language_slug: str) -> dict: + # pylint: disable=method-hidden """ Create a new ticket (i.e. initialize a new chat conversation) @@ -141,8 +142,8 @@ def _transform_attachment( )[0].random_hash, } - # pylint: disable=method-hidden def get_messages(self, chat: UserChat) -> dict[str, dict | list[dict]]: + # pylint: disable=method-hidden """ Get all non-internal messages for a given ticket @@ -164,7 +165,6 @@ def get_messages(self, chat: UserChat) -> dict[str, dict | list[dict]]: return {"messages": response} - # pylint: disable=method-hidden def send_message( self, chat_id: int, @@ -172,6 +172,7 @@ def send_message( internal: bool = False, automatic_message: bool = False, ) -> dict: + # pylint: disable=method-hidden """ Post a new message to the given ticket @@ -198,8 +199,8 @@ def send_message( self._attempt_call(self.client.ticket_article.create, params=params) ) - # pylint: disable=method-hidden def get_attachment(self, attachment_map: AttachmentMap) -> bytes | dict: + # pylint: disable=method-hidden """ Get the (binary) attachment file from Zammad. diff --git a/integreat_cms/api/v3/events.py b/integreat_cms/api/v3/events.py index 82da0fef3a..1d94624967 100644 --- a/integreat_cms/api/v3/events.py +++ b/integreat_cms/api/v3/events.py @@ -175,8 +175,11 @@ def transform_event_recurrences( @json_response -# pylint: disable=unused-argument -def events(request: HttpRequest, region_slug: str, language_slug: str) -> JsonResponse: +def events( + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, +) -> JsonResponse: """ List all events of the region and transform result into JSON diff --git a/integreat_cms/api/v3/feedback/event_list_feedback.py b/integreat_cms/api/v3/feedback/event_list_feedback.py index 9f38c6f171..9cc2bb1e59 100644 --- a/integreat_cms/api/v3/feedback/event_list_feedback.py +++ b/integreat_cms/api/v3/feedback/event_list_feedback.py @@ -17,9 +17,8 @@ @feedback_handler @json_response -# pylint: disable=unused-argument def event_list_feedback( - data: dict, + data: dict, # pylint: disable=unused-argument region: Region, language: Language, comment: str, diff --git a/integreat_cms/api/v3/feedback/imprint_page_feedback.py b/integreat_cms/api/v3/feedback/imprint_page_feedback.py index eaec2722a3..6dabdc681e 100644 --- a/integreat_cms/api/v3/feedback/imprint_page_feedback.py +++ b/integreat_cms/api/v3/feedback/imprint_page_feedback.py @@ -44,9 +44,8 @@ def imprint_page_feedback( ) -# pylint: disable=unused-argument def imprint_page_feedback_internal( - data: dict, + data: dict, # pylint: disable=unused-argument region: Region, language: Language, comment: str, diff --git a/integreat_cms/api/v3/feedback/map_feedback.py b/integreat_cms/api/v3/feedback/map_feedback.py index c46c315b63..7e0859d76c 100644 --- a/integreat_cms/api/v3/feedback/map_feedback.py +++ b/integreat_cms/api/v3/feedback/map_feedback.py @@ -17,9 +17,8 @@ @feedback_handler @json_response -# pylint: disable=unused-argument def map_feedback( - data: dict, + data: dict, # pylint: disable=unused-argument region: Region, language: Language, comment: str, diff --git a/integreat_cms/api/v3/feedback/offer_list_feedback.py b/integreat_cms/api/v3/feedback/offer_list_feedback.py index 2a3d0845a2..1ba80bdfb0 100644 --- a/integreat_cms/api/v3/feedback/offer_list_feedback.py +++ b/integreat_cms/api/v3/feedback/offer_list_feedback.py @@ -17,9 +17,8 @@ @feedback_handler @json_response -# pylint: disable=unused-argument def offer_list_feedback( - data: dict, + data: dict, # pylint: disable=unused-argument region: Region, language: Language, comment: str, diff --git a/integreat_cms/api/v3/feedback/region_feedback.py b/integreat_cms/api/v3/feedback/region_feedback.py index 33e9446f4e..fff27eeafe 100644 --- a/integreat_cms/api/v3/feedback/region_feedback.py +++ b/integreat_cms/api/v3/feedback/region_feedback.py @@ -17,9 +17,8 @@ @feedback_handler @json_response -# pylint: disable=unused-argument def region_feedback( - data: dict, + data: dict, # pylint: disable=unused-argument region: Region, language: Language, comment: str, diff --git a/integreat_cms/api/v3/imprint.py b/integreat_cms/api/v3/imprint.py index a4cf8cbeb6..9e1b92e2b4 100644 --- a/integreat_cms/api/v3/imprint.py +++ b/integreat_cms/api/v3/imprint.py @@ -49,8 +49,11 @@ def transform_imprint(imprint_translation: ImprintPageTranslation) -> dict[str, @json_response -# pylint: disable=unused-argument -def imprint(request: HttpRequest, region_slug: str, language_slug: str) -> JsonResponse: +def imprint( + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, +) -> JsonResponse: """ Get imprint for language and return JSON object to client. If no imprint translation is available in the selected language, try to return the translation in the region diff --git a/integreat_cms/api/v3/languages.py b/integreat_cms/api/v3/languages.py index 2602ee63c8..856751a76f 100644 --- a/integreat_cms/api/v3/languages.py +++ b/integreat_cms/api/v3/languages.py @@ -36,8 +36,9 @@ def transform_language(language: Language) -> dict[str, Any]: @json_response -# pylint: disable=unused-argument -def languages(request: HttpRequest, region_slug: str) -> JsonResponse: +def languages( + request: HttpRequest, region_slug: str # pylint: disable=unused-argument +) -> JsonResponse: """ Function to add all languages related to a region to a JSON. diff --git a/integreat_cms/api/v3/location_categories.py b/integreat_cms/api/v3/location_categories.py index 348bcbd7ee..d4a0cfa12c 100644 --- a/integreat_cms/api/v3/location_categories.py +++ b/integreat_cms/api/v3/location_categories.py @@ -50,9 +50,10 @@ def transform_location_category( @json_response -# pylint: disable=unused-argument def location_categories( - request: HttpRequest, region_slug: str, language_slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, ) -> JsonResponse: """ Function to return all POI categories as JSON. diff --git a/integreat_cms/api/v3/locations.py b/integreat_cms/api/v3/locations.py index ce4d04acc5..3c9231d470 100644 --- a/integreat_cms/api/v3/locations.py +++ b/integreat_cms/api/v3/locations.py @@ -115,9 +115,10 @@ def transform_poi_translation(poi_translation: POITranslation) -> dict[str, Any] @json_response -# pylint: disable=unused-argument def locations( - request: HttpRequest, region_slug: str, language_slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, ) -> JsonResponse: """ List all POIs of the region and transform result into JSON diff --git a/integreat_cms/api/v3/offers.py b/integreat_cms/api/v3/offers.py index bb24a64490..3c6959b8c5 100644 --- a/integreat_cms/api/v3/offers.py +++ b/integreat_cms/api/v3/offers.py @@ -77,9 +77,10 @@ def transform_offer(offer: OfferTemplate, region: Region) -> dict[str, Any]: @json_response -# pylint: disable=unused-argument def offers( - request: HttpRequest, region_slug: str, language_slug: str | None = None + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str | None = None, # pylint: disable=unused-argument ) -> JsonResponse: """ Function to iterate through all offers related to a region and adds them to a JSON. diff --git a/integreat_cms/api/v3/pages.py b/integreat_cms/api/v3/pages.py index 88c8119647..d6d8232500 100644 --- a/integreat_cms/api/v3/pages.py +++ b/integreat_cms/api/v3/pages.py @@ -112,8 +112,11 @@ def transform_page(page_translation: PageTranslation) -> dict[str, Any]: @matomo_tracking @json_response -# pylint: disable=unused-argument -def pages(request: HttpRequest, region_slug: str, language_slug: str) -> JsonResponse: +def pages( + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, +) -> JsonResponse: """ Function to iterate through all non-archived pages of a region and return them as JSON. @@ -205,9 +208,10 @@ def get_single_page(request: HttpRequest, language_slug: str) -> Page: @json_response -# pylint: disable=unused-argument def single_page( - request: HttpRequest, region_slug: str, language_slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, ) -> JsonResponse: """ View function returning the desired page as a JSON or a 404 if the @@ -277,8 +281,11 @@ def children( @json_response -# pylint: disable=unused-argument -def parents(request: HttpRequest, region_slug: str, language_slug: str) -> JsonResponse: +def parents( + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, +) -> JsonResponse: """ Retrieves all ancestors (parent and all nodes up to the root node) of a page. If any ancestor is archived, an 404 is raised. @@ -326,10 +333,9 @@ def get_public_ancestor_translations( @csrf_exempt @json_response -# pylint: disable=unused-argument def push_page_translation_content( request: HttpRequest, - region_slug: str, + region_slug: str, # pylint: disable=unused-argument language_slug: str, ) -> JsonResponse: """ diff --git a/integreat_cms/api/v3/pdf_export.py b/integreat_cms/api/v3/pdf_export.py index aebc1c4775..0d8556def8 100644 --- a/integreat_cms/api/v3/pdf_export.py +++ b/integreat_cms/api/v3/pdf_export.py @@ -24,9 +24,10 @@ @json_response @never_cache -# pylint: disable=unused-argument def pdf_export( - request: HttpRequest, region_slug: str, language_slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, ) -> HttpResponseRedirect: """ View function that either returns the requested page specified by the diff --git a/integreat_cms/api/v3/regions.py b/integreat_cms/api/v3/regions.py index 43b49d03e8..31316b4387 100644 --- a/integreat_cms/api/v3/regions.py +++ b/integreat_cms/api/v3/regions.py @@ -69,8 +69,9 @@ def regions(_: HttpRequest) -> JsonResponse: @json_response -# pylint: disable=unused-argument -def region_by_slug(request: HttpRequest, region_slug: str) -> JsonResponse: +def region_by_slug( + request: HttpRequest, region_slug: str # pylint: disable=unused-argument +) -> JsonResponse: """ Retrieve a single region and transform result into JSON diff --git a/integreat_cms/api/v3/social_media_headers.py b/integreat_cms/api/v3/social_media_headers.py index 858329760b..9448c11562 100644 --- a/integreat_cms/api/v3/social_media_headers.py +++ b/integreat_cms/api/v3/social_media_headers.py @@ -183,9 +183,10 @@ def root_social_media_headers( @partial_html_response -# pylint: disable=unused-argument def region_social_media_headers( - request: HttpRequest, region_slug: str, language_slug: str | None = None + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str | None = None, ) -> HttpResponse: """ Generally renders the social media headers for a root region page. @@ -211,9 +212,11 @@ def region_social_media_headers( @partial_html_response -# pylint: disable=unused-argument, fixme def page_social_media_headers( - request: HttpRequest, region_slug: str, language_slug: str, path: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, + path: str, ) -> HttpResponse: """ Tries rendering the social media headers for a page in a specified region and language. @@ -236,6 +239,7 @@ def page_social_media_headers( ): raise Http404("Page not found in this region with this language.") + # pylint: disable=fixme # TODO: add breadcrumb json-ld if content_translation exists return render_social_media_headers( request=request, @@ -247,9 +251,11 @@ def page_social_media_headers( @partial_html_response -# pylint: disable=unused-argument, fixme def event_social_media_headers( - request: HttpRequest, region_slug: str, language_slug: str, slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, + slug: str, ) -> HttpResponse: """ Tries rendering the social_media headers for an event page in a specified region and language. @@ -271,6 +277,7 @@ def event_social_media_headers( ): raise Http404("Event not found in this region with this language.") + # pylint: disable=fixme # TODO: add event json-ld return render_social_media_headers( request=request, @@ -282,9 +289,11 @@ def event_social_media_headers( @partial_html_response -# pylint: disable=unused-argument def news_social_media_headers( - request: HttpRequest, region_slug: str, language_slug: str, slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, + slug: str, ) -> HttpResponse: """ Tries rendering the social media headers for a news page in a specified region and language. @@ -318,9 +327,11 @@ def news_social_media_headers( @partial_html_response -# pylint: disable=unused-argument def location_social_media_headers( - request: HttpRequest, region_slug: str, language_slug: str, slug: str + request: HttpRequest, + region_slug: str, # pylint: disable=unused-argument + language_slug: str, + slug: str, ) -> HttpResponse: """ Tries rendering the social media headers for a location page in a specified region and language. diff --git a/integreat_cms/cms/apps.py b/integreat_cms/cms/apps.py index 7e950f70af..497e34a4a0 100644 --- a/integreat_cms/cms/apps.py +++ b/integreat_cms/cms/apps.py @@ -28,8 +28,8 @@ class CmsConfig(AppConfig): #: Human-readable name for the application verbose_name: Final[Promise] = _("CMS") - # pylint: disable=import-outside-toplevel def ready(self) -> None: + # pylint: disable=import-outside-toplevel """ Monkeypatch the checking of internal URLs """ diff --git a/integreat_cms/cms/constants/linkcheck.py b/integreat_cms/cms/constants/linkcheck.py index 9348c195a6..b9cb918392 100644 --- a/integreat_cms/cms/constants/linkcheck.py +++ b/integreat_cms/cms/constants/linkcheck.py @@ -26,5 +26,5 @@ ("external", _("External links")), ("mailto", _("Email links")), ("phone", _("Phone links")), - ("invalid", _("Invalid links")), + ("invalid", _("Verification needed")), ] diff --git a/integreat_cms/cms/forms/events/event_filter_form.py b/integreat_cms/cms/forms/events/event_filter_form.py index bf6bebde3e..97ea8f495e 100644 --- a/integreat_cms/cms/forms/events/event_filter_form.py +++ b/integreat_cms/cms/forms/events/event_filter_form.py @@ -73,10 +73,10 @@ class EventFilterForm(CustomFilterForm): query = forms.CharField(required=False) - # pylint: disable=too-many-branches def apply( self, events: EventQuerySet, region: Region, language_slug: str ) -> tuple[EventQuerySet, None, None]: + # pylint: disable=too-many-branches """ Filter the events according to the given filter data diff --git a/integreat_cms/cms/forms/events/event_translation_form.py b/integreat_cms/cms/forms/events/event_translation_form.py index c85e02da03..65a043c2d6 100644 --- a/integreat_cms/cms/forms/events/event_translation_form.py +++ b/integreat_cms/cms/forms/events/event_translation_form.py @@ -8,8 +8,8 @@ logger = logging.getLogger(__name__) -# pylint: disable=too-many-ancestors class EventTranslationForm(MachineTranslationForm): + # pylint: disable=too-many-ancestors """ Form for creating and modifying event translation objects """ diff --git a/integreat_cms/cms/forms/language_tree/language_tree_node_form.py b/integreat_cms/cms/forms/language_tree/language_tree_node_form.py index d029a486b6..058ea0d04d 100644 --- a/integreat_cms/cms/forms/language_tree/language_tree_node_form.py +++ b/integreat_cms/cms/forms/language_tree/language_tree_node_form.py @@ -18,8 +18,8 @@ logger = logging.getLogger(__name__) -# pylint: disable=too-many-ancestors class LanguageTreeNodeForm(CustomModelForm, CustomTreeNodeForm): + # pylint: disable=too-many-ancestors """ Form for creating and modifying language tree node objects """ diff --git a/integreat_cms/cms/forms/pages/mirrored_page_field_widget.py b/integreat_cms/cms/forms/pages/mirrored_page_field_widget.py index 60bd4613b2..d85a014a73 100644 --- a/integreat_cms/cms/forms/pages/mirrored_page_field_widget.py +++ b/integreat_cms/cms/forms/pages/mirrored_page_field_widget.py @@ -19,7 +19,6 @@ class MirroredPageFieldWidget(forms.widgets.Select): #: The current language slug language_slug: str | None = None - # pylint: disable=too-many-arguments, too-many-positional-arguments def create_option( self, name: str, @@ -30,6 +29,7 @@ def create_option( subindex: int | None = None, attrs: dict | None = None, ) -> dict: + # pylint: disable=too-many-arguments, too-many-positional-arguments """ This function creates an option which can be selected in the parent field diff --git a/integreat_cms/cms/forms/pages/page_form.py b/integreat_cms/cms/forms/pages/page_form.py index 065e6ffbe4..66809268da 100644 --- a/integreat_cms/cms/forms/pages/page_form.py +++ b/integreat_cms/cms/forms/pages/page_form.py @@ -26,8 +26,8 @@ logger = logging.getLogger(__name__) -# pylint: disable=too-many-ancestors class PageForm(CustomModelForm, CustomTreeNodeForm): + # pylint: disable=too-many-ancestors """ Form for creating and modifying page objects """ diff --git a/integreat_cms/cms/forms/pages/page_translation_form.py b/integreat_cms/cms/forms/pages/page_translation_form.py index 541c80b91f..c7e9621baf 100644 --- a/integreat_cms/cms/forms/pages/page_translation_form.py +++ b/integreat_cms/cms/forms/pages/page_translation_form.py @@ -8,8 +8,8 @@ logger = logging.getLogger(__name__) -# pylint: disable=too-many-ancestors class PageTranslationForm(MachineTranslationForm): + # pylint: disable=too-many-ancestors """ Form for creating and modifying page translation objects """ diff --git a/integreat_cms/cms/forms/pages/parent_field_widget.py b/integreat_cms/cms/forms/pages/parent_field_widget.py index e122b2f6d8..b97095e8f8 100644 --- a/integreat_cms/cms/forms/pages/parent_field_widget.py +++ b/integreat_cms/cms/forms/pages/parent_field_widget.py @@ -19,7 +19,6 @@ class ParentFieldWidget(forms.widgets.Select): #: The form this field is bound to form = None - # pylint: disable=too-many-arguments,too-many-positional-arguments def create_option( self, name: str, @@ -30,6 +29,7 @@ def create_option( subindex: Any | None = None, attrs: dict[str, Any] | None = None, ) -> dict[str, Any]: + # pylint: disable=too-many-arguments,too-many-positional-arguments """ This function creates an option which can be selected in the parent field diff --git a/integreat_cms/cms/forms/pois/poi_form.py b/integreat_cms/cms/forms/pois/poi_form.py index cf43369730..b3645cc466 100644 --- a/integreat_cms/cms/forms/pois/poi_form.py +++ b/integreat_cms/cms/forms/pois/poi_form.py @@ -78,8 +78,8 @@ def __init__(self, **kwargs: Any) -> None: self.instance.region.organizations.filter(archived=False) ) - # pylint: disable=too-many-return-statements def clean_opening_hours(self) -> list[dict[str, Any]]: + # pylint: disable=too-many-return-statements """ Validate the opening hours field (see :ref:`overriding-modelform-clean-method`). diff --git a/integreat_cms/cms/forms/pois/poi_translation_form.py b/integreat_cms/cms/forms/pois/poi_translation_form.py index 28f3af72af..81366de174 100644 --- a/integreat_cms/cms/forms/pois/poi_translation_form.py +++ b/integreat_cms/cms/forms/pois/poi_translation_form.py @@ -12,8 +12,8 @@ logger = logging.getLogger(__name__) -# pylint: disable=too-many-ancestors class POITranslationForm(MachineTranslationForm): + # pylint: disable=too-many-ancestors """ Form for creating and modifying POI translation objects """ diff --git a/integreat_cms/cms/forms/regions/region_form.py b/integreat_cms/cms/forms/regions/region_form.py index 1c839827d9..fcf57dc60f 100644 --- a/integreat_cms/cms/forms/regions/region_form.py +++ b/integreat_cms/cms/forms/regions/region_form.py @@ -331,8 +331,8 @@ def save(self, commit: bool = True) -> Region: return region - # pylint: disable=too-many-branches def clean(self) -> dict[str, Any]: + # pylint: disable=too-many-branches """ Validate form fields which depend on each other, see :meth:`django.forms.Form.clean` @@ -752,7 +752,6 @@ def duplicate_language_tree( ) -# pylint: disable=too-many-locals,too-many-positional-arguments,too-many-arguments def duplicate_pages( source_region: Region, target_region: Region, @@ -763,6 +762,7 @@ def duplicate_pages( offers_to_discard: QuerySet[OfferTemplate] | None = None, only_root: bool = False, ) -> None: + # pylint: disable=too-many-locals, too-many-positional-arguments, too-many-arguments """ Function to duplicate all non-archived pages from one region to another @@ -946,14 +946,16 @@ def duplicate_imprint( imprint_translation.save(update_timestamp=False) -# pylint: disable=unused-argument,fixme -def duplicate_media(source_region: Region, target_region: Region) -> None: +def duplicate_media( + source_region: Region, target_region: Region # pylint: disable=unused-argument +) -> None: """ Function to duplicate all media of one region to another. :param source_region: the source region from which the pages should be duplicated :param target_region: the target region """ + # pylint: disable=fixme # TODO: implement duplication of all media files diff --git a/integreat_cms/cms/forms/users/organization_field.py b/integreat_cms/cms/forms/users/organization_field.py index 27ce995fbc..9d449f6512 100644 --- a/integreat_cms/cms/forms/users/organization_field.py +++ b/integreat_cms/cms/forms/users/organization_field.py @@ -18,7 +18,6 @@ class OrganizationFieldWidget(Select): Select widget which puts the organization's region id as data attribute on """ - # pylint: disable=too-many-arguments, too-many-positional-arguments def create_option( self, name: str, @@ -29,6 +28,7 @@ def create_option( subindex: Any | None = None, attrs: dict[str, str] | None = None, ) -> dict[str, Any]: + # pylint: disable=too-many-arguments, too-many-positional-arguments """ This function creates an option which can be selected in the organization field diff --git a/integreat_cms/cms/forms/users/password_reset_form.py b/integreat_cms/cms/forms/users/password_reset_form.py index e1f77c5377..23555fd086 100644 --- a/integreat_cms/cms/forms/users/password_reset_form.py +++ b/integreat_cms/cms/forms/users/password_reset_form.py @@ -27,7 +27,6 @@ class CustomPasswordResetForm(PasswordResetForm): widget=forms.EmailInput(attrs={"autocomplete": "email"}), ) - # pylint: disable=signature-differs,too-many-positional-arguments def send_mail( self, subject_template_name: str, @@ -37,6 +36,7 @@ def send_mail( to_email: str, html_email_template_name: str, ) -> None: + # pylint: disable=signature-differs,too-many-positional-arguments """ Send a django.core.mail.EmailMultiAlternatives to `to_email`. diff --git a/integreat_cms/cms/migrations/0002_roles.py b/integreat_cms/cms/migrations/0002_roles.py index 427383e88e..92ebf15349 100644 --- a/integreat_cms/cms/migrations/0002_roles.py +++ b/integreat_cms/cms/migrations/0002_roles.py @@ -235,8 +235,10 @@ ] -# pylint: disable=unused-argument -def add_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def add_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Add the default roles for users @@ -265,8 +267,10 @@ def add_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: group.permissions.add(*permissions) -# pylint: disable=unused-argument -def remove_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def remove_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Remove the default roles for users diff --git a/integreat_cms/cms/migrations/0005_grant_imprint_deletion_permission.py b/integreat_cms/cms/migrations/0005_grant_imprint_deletion_permission.py index 0172e69561..9b199ae45e 100644 --- a/integreat_cms/cms/migrations/0005_grant_imprint_deletion_permission.py +++ b/integreat_cms/cms/migrations/0005_grant_imprint_deletion_permission.py @@ -10,8 +10,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def add_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def add_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Add the default roles for users @@ -28,8 +30,10 @@ def add_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: management_group.permissions.add(delete_imprint_permission) -# pylint: disable=unused-argument -def remove_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def remove_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Remove the default roles for users diff --git a/integreat_cms/cms/migrations/0007_change_role_permissions.py b/integreat_cms/cms/migrations/0007_change_role_permissions.py index be9beb756a..752b53a0ff 100644 --- a/integreat_cms/cms/migrations/0007_change_role_permissions.py +++ b/integreat_cms/cms/migrations/0007_change_role_permissions.py @@ -34,8 +34,10 @@ ] -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update the permissions of roles @@ -59,8 +61,10 @@ def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: group.permissions.remove(*remove_permissions) -# pylint: disable=unused-argument -def revert_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def revert_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Revert the permission changes of this migration diff --git a/integreat_cms/cms/migrations/0012_mediafile_file_size.py b/integreat_cms/cms/migrations/0012_mediafile_file_size.py index 5a822ad0de..0a12f93a64 100644 --- a/integreat_cms/cms/migrations/0012_mediafile_file_size.py +++ b/integreat_cms/cms/migrations/0012_mediafile_file_size.py @@ -13,8 +13,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def calculate_file_fields(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def calculate_file_fields( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Calculates the file size for already existing MediaFiles on the system. :param apps: The configuration of installed applications diff --git a/integreat_cms/cms/migrations/0015_user_unique_email_field.py b/integreat_cms/cms/migrations/0015_user_unique_email_field.py index 95bb49795a..4efd7d2dc0 100644 --- a/integreat_cms/cms/migrations/0015_user_unique_email_field.py +++ b/integreat_cms/cms/migrations/0015_user_unique_email_field.py @@ -13,9 +13,9 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument def make_user_email_field_unique( - apps: Apps, schema_editor: BaseDatabaseSchemaEditor + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: """ Make sure that the email field of users is unique diff --git a/integreat_cms/cms/migrations/0022_rename_media_directories.py b/integreat_cms/cms/migrations/0022_rename_media_directories.py index 64929e8543..d26d187916 100644 --- a/integreat_cms/cms/migrations/0022_rename_media_directories.py +++ b/integreat_cms/cms/migrations/0022_rename_media_directories.py @@ -53,9 +53,9 @@ def replace_media_prefix(media: MediaFile, before: str, after: str) -> None: ) -# pylint: disable=unused-argument def rename_media_directories( - apps: Apps, schema_editor: BaseDatabaseSchemaEditor + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: """ Renames the location of the physical files of the already existing MediaFiles on the system. @@ -128,9 +128,9 @@ def rename_media_directories( ) -# pylint: disable=unused-argument def reverse_rename_media_directories( - apps: Apps, schema_editor: BaseDatabaseSchemaEditor + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: """ Reverse the renaming of the media directories diff --git a/integreat_cms/cms/migrations/0025_update_roles.py b/integreat_cms/cms/migrations/0025_update_roles.py index 702ce50333..8065fd143f 100644 --- a/integreat_cms/cms/migrations/0025_update_roles.py +++ b/integreat_cms/cms/migrations/0025_update_roles.py @@ -12,8 +12,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update the role definitions diff --git a/integreat_cms/cms/migrations/0034_organization_region.py b/integreat_cms/cms/migrations/0034_organization_region.py index 53f5e8df9d..afdb47119b 100644 --- a/integreat_cms/cms/migrations/0034_organization_region.py +++ b/integreat_cms/cms/migrations/0034_organization_region.py @@ -16,8 +16,10 @@ RESET = "\x1b[0;39m" -# pylint: disable=unused-argument -def delete_organizations(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def delete_organizations( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Delete all existing organizations because they have to be region-specific now diff --git a/integreat_cms/cms/migrations/0035_alter_chatmessage_options.py b/integreat_cms/cms/migrations/0035_alter_chatmessage_options.py index a1c3009a1d..378fc29436 100644 --- a/integreat_cms/cms/migrations/0035_alter_chatmessage_options.py +++ b/integreat_cms/cms/migrations/0035_alter_chatmessage_options.py @@ -14,8 +14,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update permissions for service and management group diff --git a/integreat_cms/cms/migrations/0036_add_non_political_flags.py b/integreat_cms/cms/migrations/0036_add_non_political_flags.py index 426f0e3051..9f279686b6 100644 --- a/integreat_cms/cms/migrations/0036_add_non_political_flags.py +++ b/integreat_cms/cms/migrations/0036_add_non_political_flags.py @@ -11,8 +11,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_flags(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_flags( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update flags of Arabic and Farsi to be non-political @@ -34,8 +36,10 @@ def update_flags(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: farsi.save() -# pylint: disable=unused-argument -def reverse_flags(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def reverse_flags( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update flags of Arabic and Farsi to be political diff --git a/integreat_cms/cms/migrations/0037_event_datetime.py b/integreat_cms/cms/migrations/0037_event_datetime.py index dd69e0387f..8f93e9bb0f 100644 --- a/integreat_cms/cms/migrations/0037_event_datetime.py +++ b/integreat_cms/cms/migrations/0037_event_datetime.py @@ -12,8 +12,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def start_and_end_init(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def start_and_end_init( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Initialize the new event datetime fields 'start' and 'end' from the respective existing fields *_date and *_time. @@ -31,7 +33,10 @@ def start_and_end_init(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> N event.save() -def start_and_end_reverse(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def start_and_end_reverse( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Initialize the old event date and time fields from the respective new fields start and end. diff --git a/integreat_cms/cms/migrations/0039_poi_category.py b/integreat_cms/cms/migrations/0039_poi_category.py index 4071e29c7b..f7c51ff151 100644 --- a/integreat_cms/cms/migrations/0039_poi_category.py +++ b/integreat_cms/cms/migrations/0039_poi_category.py @@ -15,8 +15,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update permissions for service and management group diff --git a/integreat_cms/cms/migrations/0043_update_organization_permissions.py b/integreat_cms/cms/migrations/0043_update_organization_permissions.py index 61a3427941..682cff9563 100644 --- a/integreat_cms/cms/migrations/0043_update_organization_permissions.py +++ b/integreat_cms/cms/migrations/0043_update_organization_permissions.py @@ -12,8 +12,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update the role definitions diff --git a/integreat_cms/cms/migrations/0044_alter_user_options.py b/integreat_cms/cms/migrations/0044_alter_user_options.py index 2de58f4302..2fa26b7845 100644 --- a/integreat_cms/cms/migrations/0044_alter_user_options.py +++ b/integreat_cms/cms/migrations/0044_alter_user_options.py @@ -14,8 +14,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update analytics permissions diff --git a/integreat_cms/cms/migrations/0051_rename_farsi_flag.py b/integreat_cms/cms/migrations/0051_rename_farsi_flag.py index d8b49d85a9..adf53c701c 100644 --- a/integreat_cms/cms/migrations/0051_rename_farsi_flag.py +++ b/integreat_cms/cms/migrations/0051_rename_farsi_flag.py @@ -10,8 +10,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_flag(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_flag( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Migrate the flag name for Farsi diff --git a/integreat_cms/cms/migrations/0053_alter_role_name.py b/integreat_cms/cms/migrations/0053_alter_role_name.py index a656636b8a..3bb77e9b07 100644 --- a/integreat_cms/cms/migrations/0053_alter_role_name.py +++ b/integreat_cms/cms/migrations/0053_alter_role_name.py @@ -14,8 +14,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update permissions for service and management group diff --git a/integreat_cms/cms/migrations/0056_update_observer_permissions.py b/integreat_cms/cms/migrations/0056_update_observer_permissions.py index 41b9d33875..cb1121c3c8 100644 --- a/integreat_cms/cms/migrations/0056_update_observer_permissions.py +++ b/integreat_cms/cms/migrations/0056_update_observer_permissions.py @@ -11,8 +11,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update the role definitions diff --git a/integreat_cms/cms/migrations/0058_translations_management_settings.py b/integreat_cms/cms/migrations/0058_translations_management_settings.py index 526907a341..89c2bc6fc3 100644 --- a/integreat_cms/cms/migrations/0058_translations_management_settings.py +++ b/integreat_cms/cms/migrations/0058_translations_management_settings.py @@ -14,8 +14,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Update translation settings permissions diff --git a/integreat_cms/cms/migrations/0066_update_poi_translation_status.py b/integreat_cms/cms/migrations/0066_update_poi_translation_status.py index fc75747872..ee37379e6e 100644 --- a/integreat_cms/cms/migrations/0066_update_poi_translation_status.py +++ b/integreat_cms/cms/migrations/0066_update_poi_translation_status.py @@ -11,9 +11,9 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument def update_poi_translation_status( - apps: Apps, schema_editor: BaseDatabaseSchemaEditor + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: """ Update poi translation status to draft for pois without the default public translation diff --git a/integreat_cms/cms/migrations/0075_add_pushnotification_multiple_regions.py b/integreat_cms/cms/migrations/0075_add_pushnotification_multiple_regions.py index 37e41dfabf..83385117cf 100644 --- a/integreat_cms/cms/migrations/0075_add_pushnotification_multiple_regions.py +++ b/integreat_cms/cms/migrations/0075_add_pushnotification_multiple_regions.py @@ -10,8 +10,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def forwards_func(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def forwards_func( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Adopting the old data when applying this migration @@ -23,8 +25,10 @@ def forwards_func(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: pn.regions.add(pn.region) -# pylint: disable=unused-argument -def reverse_func(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def reverse_func( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Reverting (most of the) newer data when reverting this migration diff --git a/integreat_cms/cms/migrations/0079_alter_page_mirrored_page.py b/integreat_cms/cms/migrations/0079_alter_page_mirrored_page.py index 53b9145034..6c6d59526a 100644 --- a/integreat_cms/cms/migrations/0079_alter_page_mirrored_page.py +++ b/integreat_cms/cms/migrations/0079_alter_page_mirrored_page.py @@ -14,8 +14,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument -def update_mirrored_pages(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_mirrored_pages( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Set the field mirrored_page to None when a page is archived or belongs to an archived region. diff --git a/integreat_cms/cms/migrations/0080_alter_poi_category.py b/integreat_cms/cms/migrations/0080_alter_poi_category.py index 21f49b191a..20369a77d7 100644 --- a/integreat_cms/cms/migrations/0080_alter_poi_category.py +++ b/integreat_cms/cms/migrations/0080_alter_poi_category.py @@ -13,9 +13,9 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument def check_and_update_poicategory( - apps: Apps, schema_editor: BaseDatabaseSchemaEditor + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: """ This function checks whether the default POI category "Other" exists and creates it if not. diff --git a/integreat_cms/cms/migrations/0081_poi_appointment_url.py b/integreat_cms/cms/migrations/0081_poi_appointment_url.py index d6eb2de409..0bece4584a 100644 --- a/integreat_cms/cms/migrations/0081_poi_appointment_url.py +++ b/integreat_cms/cms/migrations/0081_poi_appointment_url.py @@ -11,9 +11,9 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor -# pylint: disable=unused-argument def set_default_appointment_only( - apps: Apps, schema_editor: BaseDatabaseSchemaEditor + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: """ Set default value for appointmentOnly diff --git a/integreat_cms/cms/migrations/0098_add_contact.py b/integreat_cms/cms/migrations/0098_add_contact.py index 3a35308056..2b214f651c 100644 --- a/integreat_cms/cms/migrations/0098_add_contact.py +++ b/integreat_cms/cms/migrations/0098_add_contact.py @@ -8,8 +8,10 @@ from integreat_cms.cms.constants import roles -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Add permissions for managing external calendars :param apps: The configuration of installed applications diff --git a/integreat_cms/cms/migrations/0101_external_calendar.py b/integreat_cms/cms/migrations/0101_external_calendar.py index 1196a31289..61b44ff8c5 100644 --- a/integreat_cms/cms/migrations/0101_external_calendar.py +++ b/integreat_cms/cms/migrations/0101_external_calendar.py @@ -9,8 +9,10 @@ from integreat_cms.cms.constants import roles -# pylint: disable=unused-argument -def update_roles(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None: +def update_roles( + apps: Apps, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument +) -> None: """ Add permissions for managing external calendars diff --git a/integreat_cms/cms/migrations/0105_treebeard_models_add_deferrable_tree_constraints.py b/integreat_cms/cms/migrations/0105_treebeard_models_add_deferrable_tree_constraints.py index a67f545190..22782fc8f6 100644 --- a/integreat_cms/cms/migrations/0105_treebeard_models_add_deferrable_tree_constraints.py +++ b/integreat_cms/cms/migrations/0105_treebeard_models_add_deferrable_tree_constraints.py @@ -16,9 +16,8 @@ def forwards_func( apps: Apps, - schema_editor: BaseDatabaseSchemaEditor, + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: - # pylint: disable=unused-argument """ Data migration step attempting to fix all trees to remove any lingering inconsistencies before adding constraints @@ -27,10 +26,9 @@ def forwards_func( def reverse_func( - apps: Apps, - schema_editor: BaseDatabaseSchemaEditor, + apps: Apps, # pylint: disable=unused-argument + schema_editor: BaseDatabaseSchemaEditor, # pylint: disable=unused-argument ) -> None: - # pylint: disable=unused-argument """ Data migration when reverting this migration (nothing to do since the data is already consistent) diff --git a/integreat_cms/cms/models/abstract_base_model.py b/integreat_cms/cms/models/abstract_base_model.py index 069d101945..a13d9ec546 100644 --- a/integreat_cms/cms/models/abstract_base_model.py +++ b/integreat_cms/cms/models/abstract_base_model.py @@ -44,8 +44,7 @@ def __repr__(self) -> str: """ try: return self.get_repr() - # pylint: disable=broad-except - except Exception as e: + except Exception as e: # pylint: disable=broad-except fallback_repr = f"<{type(self).__name__} (id: {self.id})>" # Skip logging if it's either a triggered SQL query or the id of the object is None and related objects do not exist yet if not ( diff --git a/integreat_cms/cms/models/abstract_content_model.py b/integreat_cms/cms/models/abstract_content_model.py index 3d20f5f7b6..b531090780 100644 --- a/integreat_cms/cms/models/abstract_content_model.py +++ b/integreat_cms/cms/models/abstract_content_model.py @@ -108,8 +108,8 @@ def prefetch_major_public_translations( ) -# pylint: disable=too-many-public-methods class AbstractContentModel(AbstractBaseModel): + # pylint: disable=too-many-public-methods """ Abstract base class for all content models """ diff --git a/integreat_cms/cms/models/abstract_content_translation.py b/integreat_cms/cms/models/abstract_content_translation.py index 2a80df8352..58c01519e7 100644 --- a/integreat_cms/cms/models/abstract_content_translation.py +++ b/integreat_cms/cms/models/abstract_content_translation.py @@ -38,8 +38,8 @@ logger = logging.getLogger(__name__) -# pylint: disable=too-many-public-methods class AbstractContentTranslation(AbstractBaseModel): + # pylint: disable=too-many-public-methods """ Data model representing a translation of some kind of content (e.g. pages or events) """ diff --git a/integreat_cms/cms/models/abstract_tree_node.py b/integreat_cms/cms/models/abstract_tree_node.py index e8fa2935a1..c0b6a650f5 100644 --- a/integreat_cms/cms/models/abstract_tree_node.py +++ b/integreat_cms/cms/models/abstract_tree_node.py @@ -66,8 +66,8 @@ def b(string): # type: ignore[no-untyped-def] return obj -# pylint: disable=attribute-defined-outside-init class AbstractTreeNode(NS_Node, AbstractBaseModel): + # pylint: disable=attribute-defined-outside-init """ Abstract data model representing a tree node within a region. """ diff --git a/integreat_cms/cms/models/chat/chat_message.py b/integreat_cms/cms/models/chat/chat_message.py index 8db1dd513e..8a6df15736 100644 --- a/integreat_cms/cms/models/chat/chat_message.py +++ b/integreat_cms/cms/models/chat/chat_message.py @@ -13,8 +13,8 @@ from django.db.models.query import QuerySet -# pylint: disable=too-few-public-methods class ChatHistoryManager(models.Manager): + # pylint: disable=too-few-public-methods """ Custom manager for returning the chat history of the last x days (as configured in :attr:`~integreat_cms.core.settings.AUTHOR_CHAT_HISTORY_DAYS`) diff --git a/integreat_cms/cms/models/chat/user_chat.py b/integreat_cms/cms/models/chat/user_chat.py index 6fed51b432..18ee5b3b84 100644 --- a/integreat_cms/cms/models/chat/user_chat.py +++ b/integreat_cms/cms/models/chat/user_chat.py @@ -15,8 +15,8 @@ from typing import Any -# pylint: disable=too-few-public-methods class UserChatManager(models.Manager): + # pylint: disable=too-few-public-methods """ custom manager providing function to get the current chat """ diff --git a/integreat_cms/cms/models/media/media_file.py b/integreat_cms/cms/models/media/media_file.py index 51de80d90a..a3fdb03b8a 100644 --- a/integreat_cms/cms/models/media/media_file.py +++ b/integreat_cms/cms/models/media/media_file.py @@ -59,8 +59,9 @@ def upload_path(instance: MediaFile, filename: str) -> str: return path -# pylint: disable=unused-argument -def upload_path_thumbnail(instance: MediaFile, filename: str) -> str: +def upload_path_thumbnail( + instance: MediaFile, filename: str # pylint: disable=unused-argument +) -> str: """ This function derives the upload path of a thumbnail file from it's original file. This makes it a bit easier to determine which thumbnail belongs to which file if there are multiple files with the diff --git a/integreat_cms/cms/models/pages/page.py b/integreat_cms/cms/models/pages/page.py index 9aec3e7fb5..91725fb47d 100644 --- a/integreat_cms/cms/models/pages/page.py +++ b/integreat_cms/cms/models/pages/page.py @@ -111,8 +111,8 @@ def cache_tree( return list(result.values()) -# pylint: disable=too-few-public-methods class PageManager(models.Manager): + # pylint: disable=too-few-public-methods """ Custom manager for pages to inherit methods from both managers for tree nodes and content objects """ diff --git a/integreat_cms/cms/models/regions/region.py b/integreat_cms/cms/models/regions/region.py index 51b83104e5..d924e7a784 100644 --- a/integreat_cms/cms/models/regions/region.py +++ b/integreat_cms/cms/models/regions/region.py @@ -63,8 +63,8 @@ def format_mt_help_text(help_text: Promise) -> str: ) -# pylint: disable=too-few-public-methods class RegionManager(models.Manager): + # pylint: disable=too-few-public-methods """ This manager annotates each region object with its language tree root node. This is done because it is required to calculate the region's @@ -96,8 +96,8 @@ def get_queryset(self) -> QuerySet: ) -# pylint: disable=too-many-public-methods class Region(AbstractBaseModel): + # pylint: disable=too-many-public-methods """ Data model representing region. """ diff --git a/integreat_cms/cms/templates/_tinymce_config.html b/integreat_cms/cms/templates/_tinymce_config.html index 5856b9ace8..0ee4af4f3f 100644 --- a/integreat_cms/cms/templates/_tinymce_config.html +++ b/integreat_cms/cms/templates/_tinymce_config.html @@ -53,6 +53,7 @@ data-speech-icon-alt="{% translate "Spoken Languages" %}" data-fax-icon-text='{% translate "Fax Number" %}' data-fax-icon-src="{% get_base_url %}{% static 'svg/fax.svg' %}" + data-fax-icon-alt="{% translate "Fax Number" %}" data-update-text='{% translate "Update" %}' data-dialog-submit-text='{% translate "Submit" %}' data-dialog-cancel-text='{% translate "Cancel" %}' diff --git a/integreat_cms/cms/templates/analytics/_broken_links_widget.html b/integreat_cms/cms/templates/analytics/_broken_links_widget.html index 4b4e19c0db..574d341542 100644 --- a/integreat_cms/cms/templates/analytics/_broken_links_widget.html +++ b/integreat_cms/cms/templates/analytics/_broken_links_widget.html @@ -31,7 +31,7 @@ - {% translate "Invalid links" %} + {% translate "Verification needed" %} @@ -45,7 +45,7 @@ - {% translate "Ignored links" %} + {% translate "Link verified" %} diff --git a/integreat_cms/cms/templates/contacts/contact_list_row.html b/integreat_cms/cms/templates/contacts/contact_list_row.html index 87be1622b3..07746c2245 100644 --- a/integreat_cms/cms/templates/contacts/contact_list_row.html +++ b/integreat_cms/cms/templates/contacts/contact_list_row.html @@ -59,6 +59,11 @@ {% endif %} {% else %} {% if perms.cms.change_contact %} + + + diff --git a/integreat_cms/cms/templates/content_versions.html b/integreat_cms/cms/templates/content_versions.html index 79cb9ab8b9..2662cb16c1 100644 --- a/integreat_cms/cms/templates/content_versions.html +++ b/integreat_cms/cms/templates/content_versions.html @@ -131,104 +131,48 @@

{% if not object.archived %} {% if can_publish %} - - - + - - - - - - - - - - - - - - - - - {% elif can_edit %} diff --git a/integreat_cms/cms/templates/events/event_list_row.html b/integreat_cms/cms/templates/events/event_list_row.html index aec013655a..3532f8fcd6 100644 --- a/integreat_cms/cms/templates/events/event_list_row.html +++ b/integreat_cms/cms/templates/events/event_list_row.html @@ -146,6 +146,11 @@ {% has_perm 'cms.change_event' request.user as can_edit_event %} {% if can_edit_event %} {% if not is_archive %} + + + {% if not event.external_calendar %}
diff --git a/integreat_cms/cms/templates/linkcheck/links_by_filter.html b/integreat_cms/cms/templates/linkcheck/links_by_filter.html index 3fed65fd19..9d7868c311 100644 --- a/integreat_cms/cms/templates/linkcheck/links_by_filter.html +++ b/integreat_cms/cms/templates/linkcheck/links_by_filter.html @@ -13,7 +13,7 @@

{% elif view.kwargs.url_filter == 'unchecked' %} {% translate "Unchecked links" %} {% elif view.kwargs.url_filter == 'ignored' %} - {% translate "Ignored links" %} + {% translate "Link verified" %} {% elif LINKCHECK_EMAIL_ENABLED and view.kwargs.url_filter == 'email' %} {% translate "Email links" %} {% elif LINKCHECK_PHONE_ENABLED and view.kwargs.url_filter == 'phone' %} @@ -143,7 +143,7 @@

{% if view.kwargs.url_filter == 'valid' %} {% translate "No valid links could be found." %} {% elif view.kwargs.url_filter == 'invalid' %} - {% translate "No invalid links could be found." %} + {% translate "No links needing verification could be found." %} {% elif view.kwargs.url_filter == 'unchecked' %} {% translate "No unchecked links could be found." %} {% elif LINKCHECK_EMAIL_ENABLED and view.kwargs.url_filter == 'email' %} @@ -151,7 +151,7 @@

{% elif LINKCHECK_PHONE_ENABLED and view.kwargs.url_filter == 'phone' %} {% translate "No phone links could be found." %} {% else %} - {% translate "No ignored links could be found." %} + {% translate "No verified links could be found." %} {% endif %} diff --git a/integreat_cms/cms/templates/pages/page_tree_node.html b/integreat_cms/cms/templates/pages/page_tree_node.html index dfce0bb660..21203e4c53 100644 --- a/integreat_cms/cms/templates/pages/page_tree_node.html +++ b/integreat_cms/cms/templates/pages/page_tree_node.html @@ -176,7 +176,7 @@ - + {% if can_edit_pages %} {% if page.mirroring_pages.exists %} diff --git a/integreat_cms/cms/templates/pois/poi_list_row.html b/integreat_cms/cms/templates/pois/poi_list_row.html index 05db3ad3a2..9640071e2c 100644 --- a/integreat_cms/cms/templates/pois/poi_list_row.html +++ b/integreat_cms/cms/templates/pois/poi_list_row.html @@ -140,10 +140,20 @@ {% endif %} {% if perms.cms.change_poi %} {% if poi.is_used %} + + + {% else %} + + +