From db1e744d7e1e78e5b7f5ab2896f05ade2dd7cc7f Mon Sep 17 00:00:00 2001 From: Jan Havrlant Date: Thu, 9 Jan 2025 12:33:39 +0100 Subject: [PATCH] =?UTF-8?q?=C3=9Aprava=20logov=C3=A1n=C3=AD=20a=20historie?= =?UTF-8?q?=20souboru?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webclient/core/repository_connector.py | 8 ++++---- webclient/historie/views.py | 3 ++- webclient/xml_generator/models.py | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/webclient/core/repository_connector.py b/webclient/core/repository_connector.py index 7e4e63c25..c7d730def 100644 --- a/webclient/core/repository_connector.py +++ b/webclient/core/repository_connector.py @@ -1448,15 +1448,15 @@ def call_digiarchiv_update(): i.active(), ) except Exception as e: - logger.error( - "core_repository_connector.FedoraTransaction.call_digiarchiv_update.Celery_error", + logger.warning( + "core_repository_connector.FedoraTransaction.call_digiarchiv_update.Celery_warning", extra={"Exception": e, "app": app}, ) call_digiarchiv_update_task.apply_async() for queue in queues: if queue is None: - logger.error( - "core_repository_connector.FedoraTransaction.call_digiarchiv_update.error", + logger.warning( + "core_repository_connector.FedoraTransaction.call_digiarchiv_update.warning", extra={"i": i, "queues": queues}, ) break diff --git a/webclient/historie/views.py b/webclient/historie/views.py index cc0f4f63f..5e3be5212 100644 --- a/webclient/historie/views.py +++ b/webclient/historie/views.py @@ -6,6 +6,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.db.models import CharField, F, Value from django.db.models.functions import Concat +from django.shortcuts import get_object_or_404 from django.utils.translation import get_language from django.views.generic import ListView from django_tables2 import SingleTableMixin @@ -175,7 +176,7 @@ def get_context_data(self, **kwargs): soubor_id = self.kwargs["soubor_id"] context["typ"] = "soubor" context["entity"] = context["typ"] - soubor = Soubor.objects.get(pk=soubor_id) + soubor = get_object_or_404(Soubor, pk=soubor_id) try: context["projekt"] = soubor.vazba.projekt_souboru except Projekt.DoesNotExist: diff --git a/webclient/xml_generator/models.py b/webclient/xml_generator/models.py index c1e49faf2..ee76b9e82 100644 --- a/webclient/xml_generator/models.py +++ b/webclient/xml_generator/models.py @@ -17,15 +17,15 @@ def check_if_task_queued(class_name, pk, task_name): i = app.control.inspect(["worker1@amcr"]) queues = (i.scheduled(),) except Exception as e: - logger.error( - "xml_generator.models.ModelWithMetadata.check_if_task_queued.Celery_error", + logger.warning( + "xml_generator.models.ModelWithMetadata.check_if_task_queued.Celery_warning", extra={"Exception": e, "app": app}, ) return False for queue in queues: if queue is None: - logger.error( - "xml_generator.models.ModelWithMetadata.check_if_task_queued.error", + logger.warning( + "xml_generator.models.ModelWithMetadata.check_if_task_queued.warning", extra={"class_name": class_name, "pk": pk, "i": i, "queues": queues}, ) return False