From fcede7515bdcc3e0e9e191c84817d405e7fe1ed5 Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Wed, 23 Mar 2011 16:00:11 -0400 Subject: [PATCH] Removed shipherd navigation_host filter exception reraising. Tweaked LazyNode - turns out the / needs to be prepended *before* trying to check if the node handles_subpath. --- contrib/shipherd/templatetags/shipherd.py | 2 -- middleware.py | 15 +++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/contrib/shipherd/templatetags/shipherd.py b/contrib/shipherd/templatetags/shipherd.py index 57fb020..1413bdf 100644 --- a/contrib/shipherd/templatetags/shipherd.py +++ b/contrib/shipherd/templatetags/shipherd.py @@ -167,6 +167,4 @@ def navigation_host(node, key): try: return Navigation.objects.filter(node__in=node.get_ancestors(include_self=True), key=key).order_by('-node__level')[0].node except: - if settings.TEMPLATE_DEBUG: - raise return node \ No newline at end of file diff --git a/middleware.py b/middleware.py index 5bcd569..5ec3e77 100644 --- a/middleware.py +++ b/middleware.py @@ -25,18 +25,17 @@ class LazyNode(object): except Node.DoesNotExist: node = None else: - if subpath and not node.handles_subpath(subpath): - node = None - - if node: if subpath is None: subpath = "" subpath = "/" + subpath - if trailing_slash and subpath[-1] != "/": - subpath += "/" - - node.subpath = subpath + if not node.handles_subpath(subpath): + node = None + else: + if trailing_slash and subpath[-1] != "/": + subpath += "/" + + node.subpath = subpath request._found_node = node -- 2.20.1