diff --git a/src/open_inwoner/openzaak/admin.py b/src/open_inwoner/openzaak/admin.py
index 9df74ee3e1..c264783118 100644
--- a/src/open_inwoner/openzaak/admin.py
+++ b/src/open_inwoner/openzaak/admin.py
@@ -190,15 +190,13 @@ def process_file_view(self, request):
error_msg_iterator = ([msg] for msg in msgs_deduped)
error_msg_html = format_html_join(
- "\n", "
{}", error_msg_iterator
+ "\n", " - {}
", error_msg_iterator
)
- error_msg_html_ordered = format_html(
+ error_msg_html = format_html(
_("It was not possible to import the following items:")
- + f" {error_msg_html}
"
- )
- self.message_user(
- request, error_msg_html_ordered, messages.ERROR
+ + f"{error_msg_html}
"
)
+ self.message_user(request, error_msg_html, messages.ERROR)
return HttpResponseRedirect(
reverse(
diff --git a/src/open_inwoner/openzaak/import_export.py b/src/open_inwoner/openzaak/import_export.py
index 8eaea2414e..519bf36f26 100644
--- a/src/open_inwoner/openzaak/import_export.py
+++ b/src/open_inwoner/openzaak/import_export.py
@@ -43,14 +43,14 @@ def extract_error_data(cls, exc: Exception, jsonl: str):
fields = data.get("fields", None)
if source_config is CatalogusConfig:
items = [
- f"Domein = {fields['domein']}",
- f"Rsin = {fields['rsin']}",
+ f"Domein = {fields['domein']!r}",
+ f"Rsin = {fields['rsin']!r}",
]
if source_config is ZaakTypeConfig:
items = [
- f"Identificatie = {fields['identificatie']}",
- f"Catalogus domein = {fields['catalogus'][0]}",
- f"Catalogus rsin = {fields['catalogus'][1]}",
+ f"Identificatie = {fields['identificatie']!r}",
+ f"Catalogus domein = {fields['catalogus'][0]!r}",
+ f"Catalogus rsin = {fields['catalogus'][1]!r}",
]
if source_config in {
ZaakTypeStatusTypeConfig,
@@ -58,10 +58,10 @@ def extract_error_data(cls, exc: Exception, jsonl: str):
ZaakTypeInformatieObjectTypeConfig,
}:
items = [
- f"omschrijving = {fields['omschrijving']}",
- f"ZaakTypeConfig identificatie = {fields['zaaktype_config'][0]}",
- f"Catalogus domein = {fields['zaaktype_config'][1]}",
- f"Catalogus rsin = {fields['zaaktype_config'][2]}",
+ f"omschrijving = {fields['omschrijving']!r}",
+ f"ZaakTypeConfig identificatie = {fields['zaaktype_config'][0]!r}",
+ f"Catalogus domein = {fields['zaaktype_config'][1]!r}",
+ f"Catalogus rsin = {fields['zaaktype_config'][2]!r}",
]
return {
diff --git a/src/open_inwoner/openzaak/tests/test_admin.py b/src/open_inwoner/openzaak/tests/test_admin.py
index fe904f1630..90a49158b6 100644
--- a/src/open_inwoner/openzaak/tests/test_admin.py
+++ b/src/open_inwoner/openzaak/tests/test_admin.py
@@ -1,3 +1,4 @@
+import html
import json
from unittest import mock
@@ -280,39 +281,39 @@ def test_import_flow_reports_errors(self) -> None:
response = form.submit().follow()
- messages = [str(msg) for msg in response.context["messages"]]
+ messages = [html.unescape(str(msg)) for msg in response.context["messages"]]
self.assertEqual(len(messages), 2)
self.assertEqual(
_("6 item(s) processed in total, with 6 failing row(s)."),
messages[0],
)
self.assertIn(
- "ZaakTypeConfig not found in target environment: Identificatie = ztc-id-a-0, "
- "Catalogus domein = DM-0, Catalogus rsin = 123456789",
+ "ZaakTypeConfig not found in target environment: Identificatie = 'ztc-id-a-0', "
+ "Catalogus domein = 'DM-0', Catalogus rsin = '123456789'",
messages[1],
)
self.assertIn(
- "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = status omschrijving, "
- "ZaakTypeConfig identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789",
+ "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = 'status omschrijving', "
+ "ZaakTypeConfig identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'",
messages[1],
)
self.assertIn(
- "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = bogus, ZaakTypeConfig "
- "identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789",
+ "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = 'bogus', ZaakTypeConfig "
+ "identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'",
messages[1],
)
self.assertIn(
- "ZaakTypeInformatieObjectTypeConfig not found in target environment: omschrijving = informatieobject, "
- "ZaakTypeConfig identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789",
+ "ZaakTypeInformatieObjectTypeConfig not found in target environment: omschrijving = 'informatieobject', "
+ "ZaakTypeConfig identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'",
messages[1],
)
self.assertIn(
- "CatalogusConfig not found in target environment: Domein = DM-0, Rsin = 123456789",
+ "CatalogusConfig not found in target environment: Domein = 'DM-0', Rsin = '123456789'",
messages[1],
)
self.assertIn(
- "ZaakTypeResultaatTypeConfig not found in target environment: omschrijving = resultaat, "
- "ZaakTypeConfig identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789",
+ "ZaakTypeResultaatTypeConfig not found in target environment: omschrijving = 'resultaat', "
+ "ZaakTypeConfig identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'",
messages[1],
)
@@ -341,13 +342,13 @@ def test_import_flow_reports_partial_errors(self) -> None:
response = form.submit().follow()
- messages = [str(msg) for msg in response.context["messages"]]
+ messages = [html.unescape(str(msg)) for msg in response.context["messages"]]
self.assertEqual(len(messages), 2)
self.assertEqual(
_("2 item(s) processed in total, with 1 failing row(s)."),
messages[0],
)
self.assertEqual(
- "It was not possible to import the following items: - ZaakTypeConfig not found in target environment: Identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789
",
+ "It was not possible to import the following items: - ZaakTypeConfig not found in target environment: Identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'
",
messages[1],
)
diff --git a/src/open_inwoner/openzaak/tests/test_import_export.py b/src/open_inwoner/openzaak/tests/test_import_export.py
index c950b825b3..50478d3e60 100644
--- a/src/open_inwoner/openzaak/tests/test_import_export.py
+++ b/src/open_inwoner/openzaak/tests/test_import_export.py
@@ -372,8 +372,8 @@ def test_import_jsonl_missing_statustype_config(self):
)
)
expected_error = ZGWImportError(
- "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = bogus, "
- "ZaakTypeConfig identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789"
+ "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = 'bogus', "
+ "ZaakTypeConfig identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'"
)
import_expected = dataclasses.asdict(
CatalogusConfigImport(
@@ -418,8 +418,8 @@ def test_import_jsonl_update_statustype_config_missing_zt_config(self):
)
)
expected_error = ZGWImportError(
- "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = status omschrijving, "
- "ZaakTypeConfig identificatie = bogus, Catalogus domein = DM-1, Catalogus rsin = 666666666"
+ "ZaakTypeStatusTypeConfig not found in target environment: omschrijving = 'status omschrijving', "
+ "ZaakTypeConfig identificatie = 'bogus', Catalogus domein = 'DM-1', Catalogus rsin = '666666666'"
)
import_expected = dataclasses.asdict(
CatalogusConfigImport(
@@ -464,8 +464,8 @@ def test_import_jsonl_update_reports_duplicates(self):
)
)
expected_error = ZGWImportError(
- "Got multiple results for ZaakTypeResultaatTypeConfig: omschrijving = resultaat, "
- "ZaakTypeConfig identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789"
+ "Got multiple results for ZaakTypeResultaatTypeConfig: omschrijving = 'resultaat', "
+ "ZaakTypeConfig identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'"
)
import_expected = dataclasses.asdict(
CatalogusConfigImport(
@@ -509,10 +509,10 @@ def test_import_jsonl_fails_with_catalogus_domein_rsin_mismatch(self):
[
# error from trying to load existing CatalogusConfig
"ERROR:open_inwoner.openzaak.import_export:"
- "CatalogusConfig not found in target environment: Domein = BAR, Rsin = 987654321",
+ "CatalogusConfig not found in target environment: Domein = 'BAR', Rsin = '987654321'",
# error from deserializing nested ZGW objects
"ERROR:open_inwoner.openzaak.import_export:"
- "ZaakTypeConfig not found in target environment: Identificatie = ztc-id-a-0, Catalogus domein = DM-0, Catalogus rsin = 123456789",
+ "ZaakTypeConfig not found in target environment: Identificatie = 'ztc-id-a-0', Catalogus domein = 'DM-0', Catalogus rsin = '123456789'",
],
)