From f388f84b071a551425f333d647555552d85df30e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 10 Dec 2022 10:09:39 -0600 Subject: [PATCH] Suppress error if menu entry has bad route name --- tailbone/menus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tailbone/menus.py b/tailbone/menus.py index 46f5c62a..8b432879 100644 --- a/tailbone/menus.py +++ b/tailbone/menus.py @@ -351,7 +351,11 @@ def make_menu_entry(request, item): } if item.get('route'): entry['route'] = item['route'] - entry['url'] = request.route_url(entry['route']) + try: + entry['url'] = request.route_url(entry['route']) + except KeyError: # happens if no such route + log.warning("invalid route name for menu entry: %s", entry) + entry['url'] = entry['route'] entry['key'] = entry['route'] else: if item.get('url'):