X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/dbb5ab771be406d90ac522e0ecd644e5ddb21e6f..9bb81b7a041bbe45235f53d37c864d49d51eff50:/middleware.py?ds=inline diff --git a/middleware.py b/middleware.py index 832bd16..c0b1e9e 100644 --- a/middleware.py +++ b/middleware.py @@ -15,16 +15,24 @@ class LazyNode(object): except Site.DoesNotExist: current_site = None + path = request._cached_node_path + trailing_slash = False + if path[-1] == '/': + trailing_slash = True + try: - node, subpath = Node.objects.get_with_path(request._cached_node_path, root=getattr(current_site, 'root_node', None), absolute_result=False) + node, subpath = Node.objects.get_with_path(path, root=getattr(current_site, 'root_node', None), absolute_result=False) except Node.DoesNotExist: node = None - if subpath is None: - subpath = "" - subpath = "/" + subpath - if node: + if subpath is None: + subpath = "" + subpath = "/" + subpath + + if trailing_slash and subpath[-1] != "/": + subpath += "/" + node.subpath = subpath request._found_node = node