X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/dbb5ab771be406d90ac522e0ecd644e5ddb21e6f..62a418ca34a8d4e8323e1c998c21b5e957739fd9:/views.py?ds=sidebyside diff --git a/views.py b/views.py index cec9c57..f5a2c7f 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.path and request.path != "/" and request.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.