web: survive bogus URIs when displaying sizes

This commit is contained in:
Brian Warner 2007-07-07 21:31:18 -07:00
parent fe3c002842
commit 5b0c9df14c

View File

@ -124,7 +124,11 @@ class Directory(rend.Page):
#ctx.fillSlots("uri", T.a(href=dl_uri_url)[html.escape(uri)])
#extract and display file size
ctx.fillSlots("size", unpack_uri(target.get_uri())['size'])
try:
size = unpack_uri(target.get_uri())['size']
except AssertionError:
size = "?"
ctx.fillSlots("size", size)
elif IDirectoryNode.providedBy(target):
# directory