X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/dbb5ab771be406d90ac522e0ecd644e5ddb21e6f..252fcb23a8b86b88db639ef2c3bf5dd9c0c2f3ae:/views.py diff --git a/views.py b/views.py index cec9c57..598be36 100644 --- a/views.py +++ b/views.py @@ -11,11 +11,26 @@ def node_view(request, path=None, **kwargs): raise MIDDLEWARE_NOT_CONFIGURED if not request.node: + if settings.APPEND_SLASH and request.path != "/": + path = request.path + + if path[-1] == "/": + path = path[:-1] + else: + path += "/" + + view, args, kwargs = resolve(path) + if view != node_view: + return HttpResponseRedirect(path) raise Http404 node = request.node subpath = request.node.subpath + # Explicitly disallow trailing slashes if we are otherwise at a node's url. + if request._cached_node_path != "/" and request._cached_node_path[-1] == "/" and subpath == "/": + return HttpResponseRedirect(node.get_absolute_url()) + if not node.handles_subpath(subpath): # If the subpath isn't handled, check settings.APPEND_SLASH. If # it's True, try to correct the subpath.