Suppress error if menu entry has bad route name

This commit is contained in:
Lance Edgar 2022-12-10 10:09:39 -06:00
parent f8f6b76657
commit f388f84b07

View file

@ -351,7 +351,11 @@ def make_menu_entry(request, item):
} }
if item.get('route'): if item.get('route'):
entry['route'] = item['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'] entry['key'] = entry['route']
else: else:
if item.get('url'): if item.get('url'):