From 9cc98c97a4a5599b48f8fc344c62383f0a8f0cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20M=C3=B8rstad?= Date: Wed, 8 Nov 2023 21:32:43 +0100 Subject: [PATCH] :bug: fix page vists title on deleted entries --- app/api/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/api/utils.py b/app/api/utils.py index 0226862..94f5fa7 100644 --- a/app/api/utils.py +++ b/app/api/utils.py @@ -110,6 +110,8 @@ def get_event_title_from_path(db, path): if not id: return None event = db.events.find_one({ 'eid': id }) + if not event: + return "Et slettet arrangement" return event["title"] # get job title from path, can be extended to retrieve other fields @@ -118,6 +120,8 @@ def get_job_title_from_path(db, path): if not id: return None job = db.jobs.find_one({ 'id': id }) + if not job: + return "En slettet stillingsultlysning" return job["title"] # function for finding objects for the paths containing uuid