From 04ab1ed184f2be0d3303b5d2abbc866e74775027 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Sat, 18 Apr 2020 17:58:59 +0200 Subject: [PATCH] Return copyright years as string --- aleksis/core/util/apps.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/aleksis/core/util/apps.py b/aleksis/core/util/apps.py index ee42aa600..d6640626a 100644 --- a/aleksis/core/util/apps.py +++ b/aleksis/core/util/apps.py @@ -10,6 +10,8 @@ from constance.signals import config_updated from license_expression import Licensing, LicenseSymbol from spdx_license_list import LICENSES +from .core_helpers import copyright_years + class AppConfig(django.apps.AppConfig): """ An extended version of DJango's AppConfig container. """ @@ -106,8 +108,22 @@ class AppConfig(django.apps.AppConfig): # TODO Try getting from distribution if not set @classmethod - def get_copyright(cls): - return getattr(cls, "copyright", tuple()) + def get_copyright(cls) -> Sequence[Tuple[str, str, str]]: + copyrights = getattr(cls, "copyright", tuple()) + + copyrights_processed = [] + + for copyright in copyrights: + copyrights_processed.append( + ( + copyright[0] if isinstance(copyright[0], str) else copyright_years(copyright[0]), + copyright[1], + copyright[2], + ) + ) + + return copyrights_processed + # TODO Try getting from distribution if not set def config_updated( -- GitLab