Permalink
Browse files

Wrapping the call to the Menu model get() in a try catch.

  • Loading branch information...
1 parent 5c10ec6 commit e09fd3bba577252274ed524a5a9a10ce171851d5 James Cooke committed May 5, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 menu/templatetags/menubuilder.py
@@ -68,7 +68,10 @@ def get_items(menu_name, current_path, user):
else:
menuitems = []
- menu = Menu.objects.get(slug=menu_name)
+ try:
+ menu = Menu.objects.get(slug=menu_name)
+ except Menu.DoesNotExist:
+ return []
for i in MenuItem.objects.filter(menu=menu).order_by('order'):
current = ( i.link_url != '/' and current_path.startswith(i.link_url)) or ( i.link_url == '/' and current_path == '/' )

0 comments on commit e09fd3b

Please sign in to comment.