From 973b53ded2e72d9a9cc334dbc9d4cd2177c6655d Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Wed, 9 Feb 2011 16:59:20 -0500 Subject: [PATCH] Minor tweak to has_navigation filter to silence all errors and return False. --- contrib/shipherd/templatetags/shipherd.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/contrib/shipherd/templatetags/shipherd.py b/contrib/shipherd/templatetags/shipherd.py index 98e3e6b..fa4ec3e 100644 --- a/contrib/shipherd/templatetags/shipherd.py +++ b/contrib/shipherd/templatetags/shipherd.py @@ -84,13 +84,16 @@ def recursenavigation(parser, token): @register.filter def has_navigation(node, key=None): - nav = node.navigation - if key is not None: - if key in nav and bool(node.navigation[key]): - return True - elif key not in node.navigation: - return False - return bool(node.navigation) + try: + nav = node.navigation + if key is not None: + if key in nav and bool(node.navigation[key]): + return True + elif key not in node.navigation: + return False + return bool(node.navigation) + except: + return False @register.filter -- 2.20.1