Skip to content

Commit c4d0040

Browse files
committed
[WIP] Update the ZGWAPIsConfigurationStep configuration step
1 parent 037fe63 commit c4d0040

File tree

6 files changed

+263
-714
lines changed

6 files changed

+263
-714
lines changed

src/open_inwoner/configurations/bootstrap/utils.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import logging
22

3+
from zgw_consumers.models import Service
4+
35
RED = "\033[31m"
46
NORMAL = "\033[0m"
57

@@ -17,3 +19,14 @@ def log_form_errors(config_step, form):
1719
)
1820
for field, errors in form.errors.items():
1921
logger.error("%s : %s" % (field, "; ".join(errors)))
22+
23+
24+
def get_service(slug: str) -> Service:
25+
"""
26+
Try to find a Service and re-raise DoesNotExist with the identifier to make debugging
27+
easier
28+
"""
29+
try:
30+
return Service.objects.get(slug=slug)
31+
except Service.DoesNotExist as e:
32+
raise Service.DoesNotExist(f"{str(e)} (identifier = {slug})")

0 commit comments

Comments
 (0)