From cd236efc689b1c01a9a4febe40ec3ba5a90196b5 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 7 Oct 2008 13:18:45 -0700 Subject: [PATCH] web/directory: t=manifest output=html: make the caps into clickable hrefs --- src/allmydata/web/directory.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 6ca04dfd..34860039 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -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): -- 2.45.2