]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
WUI: fix display of empty directories, it threw an exception before
authorBrian Warner <warner@allmydata.com>
Fri, 20 Mar 2009 23:58:09 +0000 (16:58 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 20 Mar 2009 23:58:09 +0000 (16:58 -0700)
src/allmydata/test/test_web.py
src/allmydata/web/directory.py

index 24eb7c2e84405b9773220905386b946fd001b3c0..ef0b616a8a266f9ead32e91727e89585c599e0ef 100644 (file)
@@ -914,6 +914,12 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase):
                                       '</td>\s+<td>DIR-RO</td>', 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):
index 8b0ea173cdc85ba08a400cbd0d9aed5d4c11057a..51837b11740a3e84ad862faf842ce3af92d4d7b0 100644 (file)
@@ -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:"],