web/directory: t=manifest output=html: make the caps into clickable hrefs

This commit is contained in:
Brian Warner 2008-10-07 13:18:45 -07:00
parent f7edbc1536
commit cd236efc68

@ -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):