From 6599eae6f9cd00e24209aa8ccacd92af2a66b916 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Fri, 20 Mar 2009 16:58:09 -0700 Subject: [PATCH] WUI: fix display of empty directories, it threw an exception before --- src/allmydata/test/test_web.py | 6 ++++++ src/allmydata/web/directory.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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:"], -- 2.45.2