]> arthur.barton.de Git - bup.git/commitdiff
If not directory root, prepend list with ".."
authorDavid Roda <davidcroda@gmail.com>
Thu, 23 Sep 2010 12:35:55 +0000 (08:35 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Tue, 9 Nov 2010 03:58:03 +0000 (19:58 -0800)
Add a link to the file list to traverse up a directory if we
are not already at the top

Signed-off-by: David Roda <davidcroda@gmail.com>
cmd/web-cmd.py

index 568811c29a259b276e697a699ebb99877e897d06..959b4f96d77a40634cbd6200029741866bf929e4 100755 (executable)
@@ -34,8 +34,14 @@ def _contains_hidden_files(n):
     return False
 
 
-def _compute_dir_contents(n, show_hidden=False):
+def _compute_dir_contents(n, path, show_hidden=False):
     """Given a vfs node, returns an iterator for display info of all subs."""
+    url_append = ""
+    if show_hidden:
+        url_append = "?hidden=1"
+
+    if path != "/":
+        yield('..', '../' + url_append, '')
     for sub in n:
         display = link = sub.name
 
@@ -47,10 +53,6 @@ def _compute_dir_contents(n, show_hidden=False):
         if not show_hidden and len(display)>1 and display.startswith('.'):
             continue
 
-        url_append = ""
-        if show_hidden:
-            url_append = "?hidden=1"
-
         size = None
         if stat.S_ISDIR(sub.mode):
             display = sub.name + '/'
@@ -105,7 +107,7 @@ class BupRequestHandler(tornado.web.RequestHandler):
             breadcrumbs=_compute_breadcrumbs(path, show_hidden),
             files_hidden=_contains_hidden_files(n),
             hidden_shown=show_hidden,
-            dir_contents=_compute_dir_contents(n, show_hidden))
+            dir_contents=_compute_dir_contents(n, path, show_hidden))
 
     def _get_file(self, path, n):
         """Process a request on a file.