From 72bf620c8452cbd9f4b86094d55faef6596d0260 Mon Sep 17 00:00:00 2001 From: Agate Berriot Date: Wed, 31 Aug 2022 16:21:16 +0200 Subject: [PATCH 2/2] django4: fix default AppConfig deprecation warnings (#68585) --- combo/apps/assets/__init__.py | 20 ---- combo/apps/assets/apps.py | 32 ++++++ combo/apps/calendar/__init__.py | 16 --- combo/apps/calendar/apps.py | 28 ++++++ combo/apps/dashboard/__init__.py | 27 ------ combo/apps/dashboard/apps.py | 36 +++++++ combo/apps/dataviz/__init__.py | 24 ----- combo/apps/dataviz/apps.py | 36 +++++++ combo/apps/family/__init__.py | 11 --- combo/apps/family/apps.py | 23 +++++ combo/apps/fargo/__init__.py | 11 --- combo/apps/fargo/apps.py | 23 +++++ combo/apps/gallery/__init__.py | 16 --- combo/apps/gallery/apps.py | 28 ++++++ combo/apps/kb/__init__.py | 11 --- combo/apps/kb/apps.py | 23 +++++ combo/apps/lingo/__init__.py | 90 ----------------- combo/apps/lingo/apps.py | 102 +++++++++++++++++++ combo/apps/maps/__init__.py | 20 ---- combo/apps/maps/apps.py | 32 ++++++ combo/apps/notifications/__init__.py | 16 --- combo/apps/notifications/apps.py | 31 ++++++ combo/apps/publik/__init__.py | 14 --- combo/apps/publik/apps.py | 26 +++++ combo/apps/pwa/__init__.py | 26 ----- combo/apps/pwa/apps.py | 38 ++++++++ combo/apps/search/__init__.py | 39 +------- combo/apps/search/apps.py | 49 ++++++++++ combo/apps/wcs/__init__.py | 128 ------------------------ combo/apps/wcs/apps.py | 140 +++++++++++++++++++++++++++ combo/data/__init__.py | 1 - combo/data/apps.py | 4 +- combo/data/utils.py | 14 +-- combo/manager/__init__.py | 2 - combo/manager/apps.py | 4 +- combo/profile/__init__.py | 46 --------- combo/profile/apps.py | 43 ++++++++ combo/settings.py | 36 +++---- tests/test_cron.py | 4 +- 39 files changed, 722 insertions(+), 548 deletions(-) create mode 100644 combo/apps/assets/apps.py create mode 100644 combo/apps/calendar/apps.py create mode 100644 combo/apps/dashboard/apps.py create mode 100644 combo/apps/dataviz/apps.py create mode 100644 combo/apps/family/apps.py create mode 100644 combo/apps/fargo/apps.py create mode 100644 combo/apps/gallery/apps.py create mode 100644 combo/apps/kb/apps.py create mode 100644 combo/apps/lingo/apps.py create mode 100644 combo/apps/maps/apps.py create mode 100644 combo/apps/notifications/apps.py create mode 100644 combo/apps/publik/apps.py create mode 100644 combo/apps/pwa/apps.py create mode 100644 combo/apps/search/apps.py create mode 100644 combo/apps/wcs/apps.py create mode 100644 combo/profile/apps.py diff --git a/combo/apps/assets/__init__.py b/combo/apps/assets/__init__.py index 86c7cbbc..3a69db31 100644 --- a/combo/apps/assets/__init__.py +++ b/combo/apps/assets/__init__.py @@ -13,23 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.urls import reverse -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.assets' - verbose_name = _('Assets') - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def get_extra_manager_actions(self): - return [{'href': reverse('combo-manager-assets'), 'text': _('Assets')}] - - -default_app_config = 'combo.apps.assets.AppConfig' diff --git a/combo/apps/assets/apps.py b/combo/apps/assets/apps.py new file mode 100644 index 00000000..a1a1db19 --- /dev/null +++ b/combo/apps/assets/apps.py @@ -0,0 +1,32 @@ +# combo - content management system +# Copyright (C) 2017-2018 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.assets' + verbose_name = _('Assets') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def get_extra_manager_actions(self): + return [{'href': reverse('combo-manager-assets'), 'text': _('Assets')}] diff --git a/combo/apps/calendar/__init__.py b/combo/apps/calendar/__init__.py index e1948718..84ebf6d1 100644 --- a/combo/apps/calendar/__init__.py +++ b/combo/apps/calendar/__init__.py @@ -13,19 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.calendar' - verbose_name = _('Calendar') - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - -default_app_config = 'combo.apps.calendar.AppConfig' diff --git a/combo/apps/calendar/apps.py b/combo/apps/calendar/apps.py new file mode 100644 index 00000000..f6ff5296 --- /dev/null +++ b/combo/apps/calendar/apps.py @@ -0,0 +1,28 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.calendar' + verbose_name = _('Calendar') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns diff --git a/combo/apps/dashboard/__init__.py b/combo/apps/dashboard/__init__.py index abf21da6..e43140c5 100644 --- a/combo/apps/dashboard/__init__.py +++ b/combo/apps/dashboard/__init__.py @@ -10,30 +10,3 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. - -import django.apps -from django.utils.timezone import now, timedelta -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.dashboard' - verbose_name = _('Dashboard') - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def hourly(self): - self.clean_autotiles() - - def clean_autotiles(self): - from combo.data.models import ConfigJsonCell - - ConfigJsonCell.objects.filter( - placeholder='_auto_tile', last_update_timestamp__lte=now() - timedelta(days=2) - ).delete() - - -default_app_config = 'combo.apps.dashboard.AppConfig' diff --git a/combo/apps/dashboard/apps.py b/combo/apps/dashboard/apps.py new file mode 100644 index 00000000..de3d4194 --- /dev/null +++ b/combo/apps/dashboard/apps.py @@ -0,0 +1,36 @@ +# combo - content management system +# Copyright (C) 2014-2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +import django.apps +from django.utils.timezone import now, timedelta +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.dashboard' + verbose_name = _('Dashboard') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def hourly(self): + self.clean_autotiles() + + def clean_autotiles(self): + from combo.data.models import ConfigJsonCell + + ConfigJsonCell.objects.filter( + placeholder='_auto_tile', last_update_timestamp__lte=now() - timedelta(days=2) + ).delete() diff --git a/combo/apps/dataviz/__init__.py b/combo/apps/dataviz/__init__.py index fbfc8484..f6e18caf 100644 --- a/combo/apps/dataviz/__init__.py +++ b/combo/apps/dataviz/__init__.py @@ -13,27 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.dataviz' - verbose_name = _('Data Visualisation') - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def hourly(self): - from .models import ChartNgCell - from .utils import update_available_statistics - - update_available_statistics() - for cell in ChartNgCell.objects.all(): - cell.check_validity() - - -default_app_config = 'combo.apps.dataviz.AppConfig' diff --git a/combo/apps/dataviz/apps.py b/combo/apps/dataviz/apps.py new file mode 100644 index 00000000..cdacd097 --- /dev/null +++ b/combo/apps/dataviz/apps.py @@ -0,0 +1,36 @@ +# combo - content management system +# Copyright (C) 2015 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.dataviz' + verbose_name = _('Data Visualisation') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def hourly(self): + from .models import ChartNgCell + from .utils import update_available_statistics + + update_available_statistics() + for cell in ChartNgCell.objects.all(): + cell.check_validity() diff --git a/combo/apps/family/__init__.py b/combo/apps/family/__init__.py index 2a5df971..05235467 100644 --- a/combo/apps/family/__init__.py +++ b/combo/apps/family/__init__.py @@ -13,14 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.family' - verbose_name = _('Family') - - -default_app_config = 'combo.apps.family.AppConfig' diff --git a/combo/apps/family/apps.py b/combo/apps/family/apps.py new file mode 100644 index 00000000..ef2d7c01 --- /dev/null +++ b/combo/apps/family/apps.py @@ -0,0 +1,23 @@ +# combo - content management system +# Copyright (C) 2021 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.family' + verbose_name = _('Family') diff --git a/combo/apps/fargo/__init__.py b/combo/apps/fargo/__init__.py index 2cb64c5a..eda1d201 100644 --- a/combo/apps/fargo/__init__.py +++ b/combo/apps/fargo/__init__.py @@ -13,14 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.fargo' - verbose_name = _('Portfolio') - - -default_app_config = 'combo.apps.fargo.AppConfig' diff --git a/combo/apps/fargo/apps.py b/combo/apps/fargo/apps.py new file mode 100644 index 00000000..d9cf043f --- /dev/null +++ b/combo/apps/fargo/apps.py @@ -0,0 +1,23 @@ +# combo - content management system +# Copyright (C) 2016 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.fargo' + verbose_name = _('Portfolio') diff --git a/combo/apps/gallery/__init__.py b/combo/apps/gallery/__init__.py index dab54177..f6e18caf 100644 --- a/combo/apps/gallery/__init__.py +++ b/combo/apps/gallery/__init__.py @@ -13,19 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.gallery' - verbose_name = _('Gallery') - - def get_after_manager_urls(self): - from . import urls - - return urls.gallery_manager_urls - - -default_app_config = 'combo.apps.gallery.AppConfig' diff --git a/combo/apps/gallery/apps.py b/combo/apps/gallery/apps.py new file mode 100644 index 00000000..a01d910f --- /dev/null +++ b/combo/apps/gallery/apps.py @@ -0,0 +1,28 @@ +# combo - content management system +# Copyright (C) 2015 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.gallery' + verbose_name = _('Gallery') + + def get_after_manager_urls(self): + from . import urls + + return urls.gallery_manager_urls diff --git a/combo/apps/kb/__init__.py b/combo/apps/kb/__init__.py index b9f7a7ee..41878f30 100644 --- a/combo/apps/kb/__init__.py +++ b/combo/apps/kb/__init__.py @@ -13,14 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.kb' - verbose_name = _('Knowledge Base') - - -default_app_config = 'combo.apps.kb.AppConfig' diff --git a/combo/apps/kb/apps.py b/combo/apps/kb/apps.py new file mode 100644 index 00000000..4d260d03 --- /dev/null +++ b/combo/apps/kb/apps.py @@ -0,0 +1,23 @@ +# combo - content management system +# Copyright (C) 2020 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.kb' + verbose_name = _('Knowledge Base') diff --git a/combo/apps/lingo/__init__.py b/combo/apps/lingo/__init__.py index 1ff71f44..bdf82251 100644 --- a/combo/apps/lingo/__init__.py +++ b/combo/apps/lingo/__init__.py @@ -13,93 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import datetime -import logging - -import django.apps -import eopayment -from django.db import transaction -from django.db.models.signals import post_migrate -from django.urls import reverse -from django.utils import timezone -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.lingo' - verbose_name = _('Payment') - - def ready(self): - post_migrate.connect(self.post_migrate_handler, sender=self) - - def post_migrate_handler(self, **kwargs): - from .models import PaymentBackend - - with transaction.atomic(): - for payment_backend in PaymentBackend.objects.all(): - service_options = payment_backend.service_options - transaction_options = {} - for parameter in payment_backend.eopayment.get_parameters(scope='transaction'): - name = parameter['name'] - if name in service_options: - transaction_options[name] = service_options.pop(name) - if not transaction_options: - continue - payment_backend.save() - for regie in payment_backend.regie_set.all(): - # merge old values in new transactions options - regie.transaction_options = dict(transaction_options, **regie.transaction_options) - regie.save() - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def get_extra_manager_actions(self): - return [{'href': reverse('lingo-manager-homepage'), 'text': _('Online Payment')}] - - def hourly(self): - self.update_transactions() - self.notify_payments() - - def update_transactions(self): - from .models import EXPIRED, Transaction - - logger = logging.getLogger(__name__) - now = timezone.now() - to_expire = Transaction.objects.filter( - start_date__lt=now - datetime.timedelta(hours=1), end_date__isnull=True - ) - for transaction in to_expire: - logger.info('transaction %r is expired', transaction.order_id) - transaction.status = EXPIRED - transaction.save() - - to_retry = Transaction.objects.filter( - status__in=(eopayment.PAID, eopayment.ACCEPTED), - to_be_paid_remote_items__isnull=False, - start_date__gt=now - datetime.timedelta(days=4), - ) - for transaction in to_retry: - transaction.retry_notify_remote_items_of_payments() - - def notify_payments(self): - from combo.apps.lingo.models import BasketItem - - logger = logging.getLogger(__name__) - now = timezone.now() - for item in BasketItem.objects.filter( - notification_date__isnull=True, - cancellation_date__isnull=True, - payment_date__lt=now - datetime.timedelta(minutes=5), - payment_date__gt=now - datetime.timedelta(minutes=300), - ): - try: - item.notify_payment() - except Exception: - logger.exception('error in async notification for basket item %s', item.id) - - -default_app_config = 'combo.apps.lingo.AppConfig' diff --git a/combo/apps/lingo/apps.py b/combo/apps/lingo/apps.py new file mode 100644 index 00000000..87bf8752 --- /dev/null +++ b/combo/apps/lingo/apps.py @@ -0,0 +1,102 @@ +# lingo - basket and payment system +# Copyright (C) 2015 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import datetime +import logging + +import django.apps +import eopayment +from django.db import transaction +from django.db.models.signals import post_migrate +from django.urls import reverse +from django.utils import timezone +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.lingo' + verbose_name = _('Payment') + + def ready(self): + post_migrate.connect(self.post_migrate_handler, sender=self) + + def post_migrate_handler(self, **kwargs): + from .models import PaymentBackend + + with transaction.atomic(): + for payment_backend in PaymentBackend.objects.all(): + service_options = payment_backend.service_options + transaction_options = {} + for parameter in payment_backend.eopayment.get_parameters(scope='transaction'): + name = parameter['name'] + if name in service_options: + transaction_options[name] = service_options.pop(name) + if not transaction_options: + continue + payment_backend.save() + for regie in payment_backend.regie_set.all(): + # merge old values in new transactions options + regie.transaction_options = dict(transaction_options, **regie.transaction_options) + regie.save() + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def get_extra_manager_actions(self): + return [{'href': reverse('lingo-manager-homepage'), 'text': _('Online Payment')}] + + def hourly(self): + self.update_transactions() + self.notify_payments() + + def update_transactions(self): + from .models import EXPIRED, Transaction + + logger = logging.getLogger(__name__) + now = timezone.now() + to_expire = Transaction.objects.filter( + start_date__lt=now - datetime.timedelta(hours=1), end_date__isnull=True + ) + for transaction in to_expire: + logger.info('transaction %r is expired', transaction.order_id) + transaction.status = EXPIRED + transaction.save() + + to_retry = Transaction.objects.filter( + status__in=(eopayment.PAID, eopayment.ACCEPTED), + to_be_paid_remote_items__isnull=False, + start_date__gt=now - datetime.timedelta(days=4), + ) + for transaction in to_retry: + transaction.retry_notify_remote_items_of_payments() + + def notify_payments(self): + from combo.apps.lingo.models import BasketItem + + logger = logging.getLogger(__name__) + now = timezone.now() + for item in BasketItem.objects.filter( + notification_date__isnull=True, + cancellation_date__isnull=True, + payment_date__lt=now - datetime.timedelta(minutes=5), + payment_date__gt=now - datetime.timedelta(minutes=300), + ): + try: + item.notify_payment() + except Exception: + logger.exception('error in async notification for basket item %s', item.id) diff --git a/combo/apps/maps/__init__.py b/combo/apps/maps/__init__.py index f5052af2..84ebf6d1 100644 --- a/combo/apps/maps/__init__.py +++ b/combo/apps/maps/__init__.py @@ -13,23 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.urls import reverse -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.maps' - verbose_name = _('Maps') - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def get_extra_manager_actions(self): - return [{'href': reverse('maps-manager-homepage'), 'text': _('Maps')}] - - -default_app_config = 'combo.apps.maps.AppConfig' diff --git a/combo/apps/maps/apps.py b/combo/apps/maps/apps.py new file mode 100644 index 00000000..96c3ae7a --- /dev/null +++ b/combo/apps/maps/apps.py @@ -0,0 +1,32 @@ +# combo - content management system +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.maps' + verbose_name = _('Maps') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def get_extra_manager_actions(self): + return [{'href': reverse('maps-manager-homepage'), 'text': _('Maps')}] diff --git a/combo/apps/notifications/__init__.py b/combo/apps/notifications/__init__.py index c64ca77b..eda1d201 100644 --- a/combo/apps/notifications/__init__.py +++ b/combo/apps/notifications/__init__.py @@ -13,19 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.notifications' - verbose_name = _('Notification') - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - -default_app_config = 'combo.apps.notifications.AppConfig' diff --git a/combo/apps/notifications/apps.py b/combo/apps/notifications/apps.py new file mode 100644 index 00000000..c64ca77b --- /dev/null +++ b/combo/apps/notifications/apps.py @@ -0,0 +1,31 @@ +# combo - content management system +# Copyright (C) 2016 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.notifications' + verbose_name = _('Notification') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + +default_app_config = 'combo.apps.notifications.AppConfig' diff --git a/combo/apps/publik/__init__.py b/combo/apps/publik/__init__.py index 70d59bf8..f6e18caf 100644 --- a/combo/apps/publik/__init__.py +++ b/combo/apps/publik/__init__.py @@ -13,17 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.publik' - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - -default_app_config = 'combo.apps.publik.AppConfig' diff --git a/combo/apps/publik/apps.py b/combo/apps/publik/apps.py new file mode 100644 index 00000000..b8975a08 --- /dev/null +++ b/combo/apps/publik/apps.py @@ -0,0 +1,26 @@ +# combo - content management system +# Copyright (C) 2015 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.publik' + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns diff --git a/combo/apps/pwa/__init__.py b/combo/apps/pwa/__init__.py index 46b5538d..9ac3c3c7 100644 --- a/combo/apps/pwa/__init__.py +++ b/combo/apps/pwa/__init__.py @@ -13,29 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import django.apps -from django.urls import reverse -from django.utils.translation import gettext_lazy as _ - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.pwa' - - def ready(self): - from . import signals # noqa pylint: disable=unused-import - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def get_extra_manager_actions(self): - from django.conf import settings - - if settings.TEMPLATE_VARS.get('pwa_display') == 'standalone': - return [{'href': reverse('pwa-manager-homepage'), 'text': _('Mobile Application (PWA)')}] - return [] - - -default_app_config = 'combo.apps.pwa.AppConfig' diff --git a/combo/apps/pwa/apps.py b/combo/apps/pwa/apps.py new file mode 100644 index 00000000..bf1078ad --- /dev/null +++ b/combo/apps/pwa/apps.py @@ -0,0 +1,38 @@ +# combo - content management system +# Copyright (C) 2015-2018 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.pwa' + + def ready(self): + from . import signals # noqa pylint: disable=unused-import + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def get_extra_manager_actions(self): + from django.conf import settings + + if settings.TEMPLATE_VARS.get('pwa_display') == 'standalone': + return [{'href': reverse('pwa-manager-homepage'), 'text': _('Mobile Application (PWA)')}] + return [] diff --git a/combo/apps/search/__init__.py b/combo/apps/search/__init__.py index e15981d9..ba847d7f 100644 --- a/combo/apps/search/__init__.py +++ b/combo/apps/search/__init__.py @@ -12,42 +12,5 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -import django.apps -from django.urls import reverse -from django.utils.translation import gettext_lazy as _ - +# along with this program. If not, see . + +import django.apps +from django.utils.translation import gettext_lazy as _ + +from .engines import engines + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.search' + verbose_name = _('Search') + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def hourly(self): + from .utils import index_site + + index_site() + + def ready(self): + # register built-in search engine for page contents + engines.register(self.get_search_engines) + + def get_search_engines(self): + from .utils import search_site + + return { + '_text': { + 'function': search_site, + 'label': _('Page Contents'), + } + } diff --git a/combo/apps/wcs/__init__.py b/combo/apps/wcs/__init__.py index 5f29c438..eda1d201 100644 --- a/combo/apps/wcs/__init__.py +++ b/combo/apps/wcs/__init__.py @@ -13,131 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -import hashlib - -import django.apps -from django.conf import settings -from django.urls import reverse -from django.utils.encoding import force_bytes -from django.utils.translation import gettext_lazy as _ -from django.utils.translation import pgettext_lazy - - -class AppConfig(django.apps.AppConfig): - name = 'combo.apps.wcs' - verbose_name = _('Forms') - - def ready(self): - from combo.apps.search import engines - - engines.register(self.get_search_engines) - - def get_search_engines(self): - from .utils import get_wcs_services - - wcs_services = get_wcs_services() - if not wcs_services: - return - - engines = self.get_portal_agent_search_engines(wcs_services) - engines.update(self.get_card_search_engines(wcs_services)) - - return engines - - def get_card_search_engines(self, wcs_services): - from combo.data.models import Page - - from .utils import get_wcs_json - - pages_with_sub_slug = Page.objects.exclude(sub_slug='') - if not pages_with_sub_slug: - return {} - - engines = {} - for key, service in wcs_services.items(): - card_models = get_wcs_json(service, 'api/cards/@list') - for card in card_models.get('data') or []: - card_id = '%s_id' % card['id'] - matching_pages = [ - p for p in pages_with_sub_slug if '<%s>' % card_id in p.sub_slug or p.sub_slug == card_id - ] - if not matching_pages: - continue - card_page = matching_pages[0] - card_page_base_url = card_page.get_online_url() - label = card['text'] - if len(wcs_services.keys()) > 1: - label = '%s (%s)' % (label, service['title']) - engines['cards:%s:%s' % (hashlib.md5(force_bytes(key)).hexdigest()[:8], card['id'])] = { - 'url': ( - service['url'] + 'api/cards/' + card['id'] + '/list/' - '{% if search_service.selected_custom_view %}{{ search_service.selected_custom_view }}{% endif %}' - '?{% if not search_service.without_user %}NameID={{ user_nameid }}&{% endif %}' - 'q=%(q)s' - ), - 'custom_views': card.get('custom_views') or [], - 'label': label, - 'signature': True, - 'hit_url_template': card_page_base_url + '{{ id }}', - 'hit_label_template': '{% firstof digest text %}', - } - return engines - - def get_portal_agent_search_engines(self, wcs_services): - if not settings.TEMPLATE_VARS.get('is_portal_agent'): - return {} - - engines = { - 'tracking-code': { - 'url': reverse('wcs-tracking-code-search') + '?q=%(q)s', - 'label': _('Tracking Code'), - } - } - for key, service in wcs_services.items(): - label = pgettext_lazy('user-forms', 'Forms') - if len(wcs_services.keys()) > 1: - label = pgettext_lazy('user-forms', 'Forms (%s)') % service['title'] - engines['formdata:%s' % hashlib.md5(force_bytes(key)).hexdigest()[:8]] = { - 'url': service['url'] - + 'api/forms/?NameID={{user_nameid}}&status=all&ignore-roles=on&include-anonymised=off&q=%(q)s', - 'label': label, - 'signature': True, - 'hit_url_template': '{% if readable %}{{ form_url_backoffice }}{% endif %}', - 'hit_label_template': '{{ title }}', - 'hit_description_template': '{{ form_digest|default:"" }}', - } - return engines - - def get_before_urls(self): - from . import urls - - return urls.urlpatterns - - def hourly(self): - from combo.data.library import get_cell_classes - from combo.data.models import CellBase - - cell_classes = [c for c in self.get_models() if c in get_cell_classes()] - for cell in CellBase.get_cells(cell_filter=lambda x: x in cell_classes, page__snapshot__isnull=True): - if hasattr(cell, 'check_validity'): - cell.check_validity() - - self.update_db_cache() - - def update_db_cache(self): - from combo.data.models import CellBase - - from .models import WcsCardCell, WcsCategoryCell, WcsFormCell, WcsFormsOfCategoryCell - - models_to_update = [ - WcsFormCell, - WcsCategoryCell, - WcsFormsOfCategoryCell, - WcsCardCell, - ] - for cell in CellBase.get_cells(cell_filter=lambda x: x in models_to_update): - cell.save() - - -default_app_config = 'combo.apps.wcs.AppConfig' diff --git a/combo/apps/wcs/apps.py b/combo/apps/wcs/apps.py new file mode 100644 index 00000000..4a66a1b8 --- /dev/null +++ b/combo/apps/wcs/apps.py @@ -0,0 +1,140 @@ +# combo - content management system +# Copyright (C) 2016 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import hashlib + +import django.apps +from django.conf import settings +from django.urls import reverse +from django.utils.encoding import force_bytes +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import pgettext_lazy + + +class AppConfig(django.apps.AppConfig): + name = 'combo.apps.wcs' + verbose_name = _('Forms') + + def ready(self): + from combo.apps.search import engines + + engines.register(self.get_search_engines) + + def get_search_engines(self): + from .utils import get_wcs_services + + wcs_services = get_wcs_services() + if not wcs_services: + return + + engines = self.get_portal_agent_search_engines(wcs_services) + engines.update(self.get_card_search_engines(wcs_services)) + + return engines + + def get_card_search_engines(self, wcs_services): + from combo.data.models import Page + + from .utils import get_wcs_json + + pages_with_sub_slug = Page.objects.exclude(sub_slug='') + if not pages_with_sub_slug: + return {} + + engines = {} + for key, service in wcs_services.items(): + card_models = get_wcs_json(service, 'api/cards/@list') + for card in card_models.get('data') or []: + card_id = '%s_id' % card['id'] + matching_pages = [ + p for p in pages_with_sub_slug if '<%s>' % card_id in p.sub_slug or p.sub_slug == card_id + ] + if not matching_pages: + continue + card_page = matching_pages[0] + card_page_base_url = card_page.get_online_url() + label = card['text'] + if len(wcs_services.keys()) > 1: + label = '%s (%s)' % (label, service['title']) + engines['cards:%s:%s' % (hashlib.md5(force_bytes(key)).hexdigest()[:8], card['id'])] = { + 'url': ( + service['url'] + 'api/cards/' + card['id'] + '/list/' + '{% if search_service.selected_custom_view %}{{ search_service.selected_custom_view }}{% endif %}' + '?{% if not search_service.without_user %}NameID={{ user_nameid }}&{% endif %}' + 'q=%(q)s' + ), + 'custom_views': card.get('custom_views') or [], + 'label': label, + 'signature': True, + 'hit_url_template': card_page_base_url + '{{ id }}', + 'hit_label_template': '{% firstof digest text %}', + } + return engines + + def get_portal_agent_search_engines(self, wcs_services): + if not settings.TEMPLATE_VARS.get('is_portal_agent'): + return {} + + engines = { + 'tracking-code': { + 'url': reverse('wcs-tracking-code-search') + '?q=%(q)s', + 'label': _('Tracking Code'), + } + } + for key, service in wcs_services.items(): + label = pgettext_lazy('user-forms', 'Forms') + if len(wcs_services.keys()) > 1: + label = pgettext_lazy('user-forms', 'Forms (%s)') % service['title'] + engines['formdata:%s' % hashlib.md5(force_bytes(key)).hexdigest()[:8]] = { + 'url': service['url'] + + 'api/forms/?NameID={{user_nameid}}&status=all&ignore-roles=on&include-anonymised=off&q=%(q)s', + 'label': label, + 'signature': True, + 'hit_url_template': '{% if readable %}{{ form_url_backoffice }}{% endif %}', + 'hit_label_template': '{{ title }}', + 'hit_description_template': '{{ form_digest|default:"" }}', + } + return engines + + def get_before_urls(self): + from . import urls + + return urls.urlpatterns + + def hourly(self): + from combo.data.library import get_cell_classes + from combo.data.models import CellBase + + cell_classes = [c for c in self.get_models() if c in get_cell_classes()] + for cell in CellBase.get_cells(cell_filter=lambda x: x in cell_classes, page__snapshot__isnull=True): + if hasattr(cell, 'check_validity'): + cell.check_validity() + + self.update_db_cache() + + def update_db_cache(self): + from combo.data.models import CellBase + + from .models import WcsCardCell, WcsCategoryCell, WcsFormCell, WcsFormsOfCategoryCell + + models_to_update = [ + WcsFormCell, + WcsCategoryCell, + WcsFormsOfCategoryCell, + WcsCardCell, + ] + for cell in CellBase.get_cells(cell_filter=lambda x: x in models_to_update): + cell.save() diff --git a/combo/data/__init__.py b/combo/data/__init__.py index 24663bc6..e69de29b 100644 --- a/combo/data/__init__.py +++ b/combo/data/__init__.py @@ -1 +0,0 @@ -default_app_config = 'combo.data.apps.DataConfig' diff --git a/combo/data/apps.py b/combo/data/apps.py index 61a49207..3ee645bc 100644 --- a/combo/data/apps.py +++ b/combo/data/apps.py @@ -14,10 +14,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from django.apps import AppConfig +import django.apps -class DataConfig(AppConfig): +class AppConfig(django.apps.AppConfig): name = 'combo.data' verbose_name = 'data' diff --git a/combo/data/utils.py b/combo/data/utils.py index a5f70f62..26417917 100644 --- a/combo/data/utils.py +++ b/combo/data/utils.py @@ -49,17 +49,17 @@ class MissingGroups(ImportSiteError): def export_site(pages=True, cartography=True, pwa=True, assets=True, payment=True, site_settings=True): '''Dump site objects to JSON-dumpable dictionnary''' - if 'combo.apps.lingo' in settings.INSTALLED_APPS: + if 'combo.apps.lingo.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.lingo.models import PaymentBackend, Regie else: payment = False - if 'combo.apps.maps' in settings.INSTALLED_APPS: + if 'combo.apps.maps.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.maps.models import MapLayer else: cartography = False - if 'combo.apps.pwa' in settings.INSTALLED_APPS: + if 'combo.apps.pwa.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.pwa.models import PwaNavigationEntry, PwaSettings else: pwa = False @@ -92,21 +92,21 @@ def import_site(data, if_empty=False, clean=False, request=None): # format. data = {'pages': data} - if 'combo.apps.lingo' in settings.INSTALLED_APPS: + if 'combo.apps.lingo.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.lingo.models import PaymentBackend, Regie payment_support = True else: payment_support = False - if 'combo.apps.maps' in settings.INSTALLED_APPS: + if 'combo.apps.maps.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.maps.models import MapLayer cartography_support = True else: cartography_support = False - if 'combo.apps.pwa' in settings.INSTALLED_APPS: + if 'combo.apps.pwa.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.pwa.models import PwaNavigationEntry, PwaSettings pwa_support = True @@ -185,7 +185,7 @@ def import_site_tar(fd, if_empty=False, clean=False, overwrite=False, request=No except KeyError: raise ImportSiteError(_('TAR file should provide _site.json file')) - if 'combo.apps.maps' in settings.INSTALLED_APPS: + if 'combo.apps.maps.apps.AppConfig' in settings.INSTALLED_APPS: from combo.apps.maps.models import MapLayer cartography_support = True diff --git a/combo/manager/__init__.py b/combo/manager/__init__.py index 056047e1..f6e18caf 100644 --- a/combo/manager/__init__.py +++ b/combo/manager/__init__.py @@ -13,5 +13,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -default_app_config = 'combo.manager.apps.ManagerAppConfig' diff --git a/combo/manager/apps.py b/combo/manager/apps.py index 61af3951..e6764ec4 100644 --- a/combo/manager/apps.py +++ b/combo/manager/apps.py @@ -14,10 +14,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from django.apps import AppConfig +import django.apps -class ManagerAppConfig(AppConfig): +class AppConfig(django.apps.AppConfig): name = 'combo.manager' def ready(self): diff --git a/combo/profile/__init__.py b/combo/profile/__init__.py index 2636dbd4..fc9dfb6a 100644 --- a/combo/profile/__init__.py +++ b/combo/profile/__init__.py @@ -16,10 +16,6 @@ # along with this program. If not, see . -import django.apps -from django.utils.translation import gettext_lazy as _ - - def user_get_name_id(user): if not hasattr(user, '_name_id'): user._name_id = None @@ -37,45 +33,3 @@ default_description_template = """{{ email|default:"" }} {% if address %} {{ address }}{% endif %} {% if zipcode %} {{ zipcode }}{% endif %} {% if city %} {{ city }}{% endif %}""" - - -class AppConfig(django.apps.AppConfig): - name = 'combo.profile' - verbose_name = _('Profile') - - def ready(self): - from combo.apps.search import engines - - engines.register(self.get_search_engines) - from django.contrib.auth import get_user_model - - get_user_model().add_to_class('get_name_id', user_get_name_id) - - def get_search_engines(self): - from django.conf import settings - - from combo.data.models import Page - - user_page = Page.objects.filter(sub_slug='name_id').first() - if not user_page: - user_page = Page.objects.filter(sub_slug__contains='').first() - if not user_page: - return - user_page_base_url = user_page.get_online_url() - - # return entry using first(&only) authentic (if it exists) - for service in settings.KNOWN_SERVICES.get('authentic', {}).values(): - return { - 'users': { - 'url': service['url'] + 'api/users/?q=%(q)s', - 'label': _('Users'), - 'signature': True, - 'data_key': 'results', - 'hit_url_template': user_page_base_url + '{{uuid}}/', - 'hit_label_template': '{{first_name}} {{last_name}}', - 'hit_description_template': default_description_template, - } - } - - -default_app_config = 'combo.profile.AppConfig' diff --git a/combo/profile/apps.py b/combo/profile/apps.py new file mode 100644 index 00000000..6a1fcd0c --- /dev/null +++ b/combo/profile/apps.py @@ -0,0 +1,43 @@ +import django.apps +from django.utils.translation import gettext_lazy as _ + +from . import default_description_template, user_get_name_id + + +class AppConfig(django.apps.AppConfig): + name = 'combo.profile' + verbose_name = _('Profile') + + def ready(self): + from combo.apps.search import engines + + engines.register(self.get_search_engines) + from django.contrib.auth import get_user_model + + get_user_model().add_to_class('get_name_id', user_get_name_id) + + def get_search_engines(self): + from django.conf import settings + + from combo.data.models import Page + + user_page = Page.objects.filter(sub_slug='name_id').first() + if not user_page: + user_page = Page.objects.filter(sub_slug__contains='').first() + if not user_page: + return + user_page_base_url = user_page.get_online_url() + + # return entry using first(&only) authentic (if it exists) + for service in settings.KNOWN_SERVICES.get('authentic', {}).values(): + return { + 'users': { + 'url': service['url'] + 'api/users/?q=%(q)s', + 'label': _('Users'), + 'signature': True, + 'data_key': 'results', + 'hit_url_template': user_page_base_url + '{{uuid}}/', + 'hit_label_template': '{{first_name}} {{last_name}}', + 'hit_description_template': default_description_template, + } + } diff --git a/combo/settings.py b/combo/settings.py index 9a4ec5ad..6560c01a 100644 --- a/combo/settings.py +++ b/combo/settings.py @@ -59,25 +59,25 @@ INSTALLED_APPS = ( 'eopayment', 'gadjo', 'sorl.thumbnail', - 'combo.data', - 'combo.profile', - 'combo.manager', + 'combo.data.apps.AppConfig', + 'combo.profile.apps.AppConfig', + 'combo.manager.apps.AppConfig', 'combo.public', - 'combo.apps.assets', - 'combo.apps.dashboard', - 'combo.apps.wcs', - 'combo.apps.publik', - 'combo.apps.family', - 'combo.apps.dataviz', - 'combo.apps.lingo', - 'combo.apps.fargo', - 'combo.apps.notifications', - 'combo.apps.search', - 'combo.apps.maps', - 'combo.apps.calendar', - 'combo.apps.pwa', - 'combo.apps.gallery', - 'combo.apps.kb', + 'combo.apps.assets.apps.AppConfig', + 'combo.apps.calendar.apps.AppConfig', + 'combo.apps.dashboard.apps.AppConfig', + 'combo.apps.dataviz.apps.AppConfig', + 'combo.apps.family.apps.AppConfig', + 'combo.apps.fargo.apps.AppConfig', + 'combo.apps.gallery.apps.AppConfig', + 'combo.apps.kb.apps.AppConfig', + 'combo.apps.lingo.apps.AppConfig', + 'combo.apps.maps.apps.AppConfig', + 'combo.apps.notifications.apps.AppConfig', + 'combo.apps.publik.apps.AppConfig', + 'combo.apps.pwa.apps.AppConfig', + 'combo.apps.search.apps.AppConfig', + 'combo.apps.wcs.apps.AppConfig', 'xstatic.pkg.leaflet', 'xstatic.pkg.opensans', 'xstatic.pkg.roboto_fontface', diff --git a/tests/test_cron.py b/tests/test_cron.py index ca944389..0fa03a9e 100644 --- a/tests/test_cron.py +++ b/tests/test_cron.py @@ -11,7 +11,7 @@ pytestmark = pytest.mark.django_db @override_settings(STATISTICS_PROVIDERS=[]) def test_cron_run(app): - with mock.patch('combo.apps.lingo.AppConfig.hourly') as hourly_job: + with mock.patch('combo.apps.lingo.apps.AppConfig.hourly') as hourly_job: call_command('cron') assert hourly_job.call_count == 1 @@ -23,7 +23,7 @@ def test_cron_run(app): def test_cron_error(app): - with mock.patch('combo.apps.lingo.AppConfig.hourly') as hourly_job: + with mock.patch('combo.apps.lingo.apps.AppConfig.hourly') as hourly_job: hourly_job.side_effect = Exception('test error') out = StringIO() with pytest.raises(CommandError): -- 2.37.2