From: Brian Warner Date: Wed, 27 Jun 2007 02:55:21 +0000 (-0700) Subject: webish.py: add a web page to display the manifest for any particular directory X-Git-Tag: allmydata-tahoe-0.4.0~21 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri//%22%22?a=commitdiff_plain;h=1d86cd161beab42fa1d40bbf6e4d4d8f59e02153;p=tahoe-lafs%2Ftahoe-lafs.git webish.py: add a web page to display the manifest for any particular directory --- diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index a4b73b7c..b6425e31 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -13,6 +13,7 @@
Refresh this view
Parent Directory
+
Manifest for this directory
To share this directory, paste the following URI string into an "Add Shared Directory" box:
diff --git a/src/allmydata/web/manifest.xhtml b/src/allmydata/web/manifest.xhtml new file mode 100644 index 00000000..0e57fe6d --- /dev/null +++ b/src/allmydata/web/manifest.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + +

+ + + + + + + + + + + + +
Refresh Capabilities
no items in the manifest!
+ + + diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index a49fcc18..70db0950 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -114,6 +114,8 @@ class Directory(rend.Page): def childFactory(self, ctx, name): if name.startswith("freeform"): # ick return None + if name == "@manifest": # ick, this time it's my fault + return Manifest(self._dirnode, self._dirname) if self._dirname == "/": dirname = "/" + name else: @@ -350,6 +352,24 @@ class Downloader(resource.Resource): self._filenode.download(WebDownloadTarget(req)) return server.NOT_DONE_YET +class Manifest(rend.Page): + docFactory = getxmlfile("manifest.xhtml") + def __init__(self, dirnode, dirname): + self._dirnode = dirnode + self._dirname = dirname + + def render_title(self, ctx): + return T.title["Manifest of %s" % self._dirname] + + def render_header(self, ctx): + return T.p["Manifest of %s" % self._dirname] + + def data_items(self, ctx, data): + return self._dirnode.build_manifest() + + def render_row(self, ctx, refresh_cap): + ctx.fillSlots("refresh_capability", refresh_cap) + return ctx.tag class Root(rend.Page):