From: Faried Nawaz Date: Fri, 4 May 2007 20:07:32 +0000 (-0700) Subject: display file size in directory.xhtml X-Git-Tag: allmydata-tahoe-0.3.0~91 X-Git-Url: https://git.rkrishnan.org/class-simplejson.JSONEncoder-index.html?a=commitdiff_plain;h=2016b846b9c791de31677cdf04cc15353603e040;p=tahoe-lafs%2Ftahoe-lafs.git display file size in directory.xhtml --- diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index a290d1fe..98fe00e7 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -17,12 +17,14 @@ Filename Type + Size URI + diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 26e4d050..b8dce062 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -4,6 +4,7 @@ from twisted.web import static, resource, server, html from twisted.python import util, log from nevow import inevow, rend, loaders, appserver, url, tags as T from allmydata.util import idlib +from allmydata.uri import unpack_uri from allmydata.interfaces import IDownloadTarget#, IDownloader from allmydata import upload from zope.interface import implements, Interface @@ -126,6 +127,10 @@ class Directory(rend.Page): dl_uri_url = dl_uri_url.add("filename", name) ctx.fillSlots("uri", T.a(href=dl_uri_url)[html.escape(uri)]) + #extract and display file size + unpacked = unpack_uri(uri) + ctx.fillSlots("size", unpacked[9]) + # this creates a button which will cause our child__delete method # to be invoked, which deletes the file and then redirects the # browser back to this directory @@ -142,6 +147,7 @@ class Directory(rend.Page): ctx.fillSlots("filename", T.a(href=subdir_url)[html.escape(name)]) ctx.fillSlots("type", "DIR") + ctx.fillSlots("size", "-") ctx.fillSlots("uri", "-") ctx.fillSlots("delete", "-") return ctx.tag