WUI: fix display of empty directories, it threw an exception before

This commit is contained in:
Brian Warner 2009-03-20 16:58:09 -07:00
parent 4f4d748fd9
commit 6599eae6f9
2 changed files with 7 additions and 1 deletions

View 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):

View 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:"],