X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/08f6ca2120d8c01bdc32b4c271772bde77db3865..8fff8672235eafa1cf55739d460119b3be5faf5f:/middleware.py diff --git a/middleware.py b/middleware.py index c0b1e9e..5bcd569 100644 --- a/middleware.py +++ b/middleware.py @@ -24,6 +24,9 @@ class LazyNode(object): node, subpath = Node.objects.get_with_path(path, root=getattr(current_site, 'root_node', None), absolute_result=False) except Node.DoesNotExist: node = None + else: + if subpath and not node.handles_subpath(subpath): + node = None if node: if subpath is None: @@ -46,7 +49,10 @@ class RequestNodeMiddleware(object): request.__class__.node = LazyNode() def process_view(self, request, view_func, view_args, view_kwargs): - request._cached_node_path = view_kwargs.get('path', '/') + try: + request._cached_node_path = view_kwargs['path'] + except KeyError: + pass def process_exception(self, request, exception): if settings.DEBUG or not hasattr(request, 'node') or not request.node: