]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web/directory: t=manifest output=html: make the caps into clickable hrefs
authorBrian Warner <warner@allmydata.com>
Tue, 7 Oct 2008 20:18:45 +0000 (13:18 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 7 Oct 2008 20:18:45 +0000 (13:18 -0700)
src/allmydata/web/directory.py

index 6ca04dfd92fd0897325c97479b90b9825900b8f1..34860039ae8e159d0290e79d1d1465f2c11b261c 100644 (file)
@@ -716,7 +716,15 @@ class Manifest(rend.Page):
 
     def render_row(self, ctx, (path, cap)):
         ctx.fillSlots("path", self.slashify_path(path))
-        ctx.fillSlots("cap", cap)
+        root = get_root(ctx)
+        # TODO: we need a clean consistent way to get the type of a cap string
+        if cap.startswith("URI:CHK") or cap.startswith("URI:SSK"):
+            nameurl = urllib.quote(path[-1].encode("utf-8"))
+            uri_link = "%s/file/%s/@@named=/%s" % (root, urllib.quote(cap),
+                                                   nameurl)
+        else:
+            uri_link = "%s/uri/%s" % (root, urllib.quote(cap))
+        ctx.fillSlots("cap", T.a(href=uri_link)[cap])
         return ctx.tag
 
 def DeepSize(ctx, dirnode):