From 5c11443b4a8b8d766b4a6e9a6eac5deff1894780 Mon Sep 17 00:00:00 2001 From: Alex de Landgraaf Date: Thu, 28 Dec 2023 14:46:26 +0100 Subject: [PATCH 1/2] [Sentry 346889] Fixing fallback and additional logging for determining internal file uploads --- src/open_inwoner/cms/cases/views/status.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/open_inwoner/cms/cases/views/status.py b/src/open_inwoner/cms/cases/views/status.py index f858c27eff..c7cc10cd2f 100644 --- a/src/open_inwoner/cms/cases/views/status.py +++ b/src/open_inwoner/cms/cases/views/status.py @@ -269,9 +269,13 @@ def get_second_status_preview(self, statustypen: list) -> Optional[StatusType]: @property def is_file_upload_enabled_for_case_type(self) -> bool: - return ZaakTypeInformatieObjectTypeConfig.objects.filter_enabled_for_case_type( + case_upload_enabled = ZaakTypeInformatieObjectTypeConfig.objects.filter_enabled_for_case_type( self.case.zaaktype ).exists() + logger.info("Case {url} has case type file upload: {case_upload_enabled}".format( + url=self.case.url, + case_upload_enabled=case_upload_enabled)) + return case_upload_enabled @property def is_file_upload_enabled_for_statustype(self) -> bool: @@ -286,6 +290,7 @@ def is_file_upload_enabled_for_statustype(self) -> bool: case=self.case ) ) + return False except KeyError: logger.info( "Could not retrieve status type config for url {url}".format( @@ -293,6 +298,10 @@ def is_file_upload_enabled_for_statustype(self) -> bool: ) ) return False + logger.info("Case {url} status type {status_type} has status type file upload: {enabled_for_status_type}".format( + url=self.case.url, + status_type=self.case.status.statustype, + enabled_for_status_type=enabled_for_status_type)) return enabled_for_status_type @property From 300842ad754372182b973c18fae1582636ad76b8 Mon Sep 17 00:00:00 2001 From: Alex de Landgraaf Date: Thu, 28 Dec 2023 14:55:44 +0100 Subject: [PATCH 2/2] Blacking --- src/open_inwoner/cms/cases/views/status.py | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/open_inwoner/cms/cases/views/status.py b/src/open_inwoner/cms/cases/views/status.py index c7cc10cd2f..3a1f2cd720 100644 --- a/src/open_inwoner/cms/cases/views/status.py +++ b/src/open_inwoner/cms/cases/views/status.py @@ -269,12 +269,16 @@ def get_second_status_preview(self, statustypen: list) -> Optional[StatusType]: @property def is_file_upload_enabled_for_case_type(self) -> bool: - case_upload_enabled = ZaakTypeInformatieObjectTypeConfig.objects.filter_enabled_for_case_type( - self.case.zaaktype - ).exists() - logger.info("Case {url} has case type file upload: {case_upload_enabled}".format( - url=self.case.url, - case_upload_enabled=case_upload_enabled)) + case_upload_enabled = ( + ZaakTypeInformatieObjectTypeConfig.objects.filter_enabled_for_case_type( + self.case.zaaktype + ).exists() + ) + logger.info( + "Case {url} has case type file upload: {case_upload_enabled}".format( + url=self.case.url, case_upload_enabled=case_upload_enabled + ) + ) return case_upload_enabled @property @@ -298,10 +302,13 @@ def is_file_upload_enabled_for_statustype(self) -> bool: ) ) return False - logger.info("Case {url} status type {status_type} has status type file upload: {enabled_for_status_type}".format( - url=self.case.url, - status_type=self.case.status.statustype, - enabled_for_status_type=enabled_for_status_type)) + logger.info( + "Case {url} status type {status_type} has status type file upload: {enabled_for_status_type}".format( + url=self.case.url, + status_type=self.case.status.statustype, + enabled_for_status_type=enabled_for_status_type, + ) + ) return enabled_for_status_type @property