From: Brian Warner Date: Sat, 31 Jan 2009 02:32:05 +0000 (-0700) Subject: web/directory: add a link from readwrite directories to a read-only version, and... X-Git-Tag: allmydata-tahoe-1.3.0~111 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/biz?a=commitdiff_plain;h=529a8e9fdb1d3ebf129f4b3c5dbe6e28ce4c0e4c;p=tahoe-lafs%2Ftahoe-lafs.git web/directory: add a link from readwrite directories to a read-only version, and fix the 'SI=xxx' header to actually use the storage index, not the writekey --- diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index dbcc34c5..a4c401f6 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -438,7 +438,7 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): def abbreviated_dirnode(dirnode): u = from_string_dirnode(dirnode.get_uri()) - return u.abbrev() + return u.abbrev_si() class DirectoryAsHTML(rend.Page): # The remainder of this class is to render the directory into @@ -466,6 +466,14 @@ class DirectoryAsHTML(rend.Page): link = get_root(ctx) return T.div[T.a(href=link)["Return to Welcome page"]] + def render_show_readonly(self, ctx, data): + if self.node.is_readonly(): + return "" + rocap = self.node.get_readonly_uri() + root = get_root(ctx) + uri_link = "%s/uri/%s/" % (root, urllib.quote(rocap)) + return ctx.tag[T.a(href=uri_link)["Read-Only Version"]] + def data_children(self, ctx, data): d = self.node.list() d.addCallback(lambda dict: sorted(dict.items())) diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index f8635a5d..8911e255 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -15,6 +15,7 @@
More info on this directory
+