From cfbb361885c5bb6978205049ed6249fb06125855 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Wed, 22 Jun 2022 18:28:21 +0200 Subject: [PATCH] Raise KeyError if choices for a disallowed collection are requested --- dj_iconify/util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dj_iconify/util.py b/dj_iconify/util.py index 10dcb43..50e0859 100644 --- a/dj_iconify/util.py +++ b/dj_iconify/util.py @@ -41,6 +41,9 @@ def icon_choices(collection: str) -> list[tuple[str, str]]: from .types import IconifyJSON + if not collection_allowed(collection): + raise KeyError("The collection %s is disallowed." % collection) + # Load icon set through Iconify types collection_file = os.path.join(JSON_ROOT, "json", f"{collection}.json") icon_set = IconifyJSON.from_file(collection_file) -- GitLab