From: Brian Warner Date: Fri, 20 Mar 2009 23:58:09 +0000 (-0700) Subject: WUI: fix display of empty directories, it threw an exception before X-Git-Tag: allmydata-tahoe-1.4.0~38 X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/nxhtml.html?a=commitdiff_plain;h=6599eae6f9cd00e24209aa8ccacd92af2a66b916;p=tahoe-lafs%2Ftahoe-lafs.git WUI: fix display of empty directories, it threw an exception before --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 24eb7c2e..ef0b616a 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -914,6 +914,12 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase): '\s+DIR-RO', res)) d.addCallback(_check3) + # and an empty directory + d.addCallback(lambda res: self.GET(self.public_url + "/foo/empty/")) + def _check4(res): + self.failUnless("directory is empty!" in res, res) + d.addCallback(_check4) + return d def test_GET_DIRURL_badtype(self): diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 8b0ea173..51837b11 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -550,7 +550,7 @@ class DirectoryAsHTML(rend.Page): def render_try_children(self, ctx, data): # if the dirnode can be retrived, render a table of children. # Otherwise, render an apologetic error message. - if self.dirnode_children: + if self.dirnode_children is not None: return ctx.tag else: return T.div[T.p["Error reading directory:"],