Improved the dirlisting's display of sizes

This commit is contained in:
Sebastian Lohff 2012-06-26 02:18:18 +02:00
parent c5cb5f45a7
commit 18775c5c72
1 changed files with 5 additions and 4 deletions

View File

@ -432,12 +432,13 @@ class DirListingHandler(FileBaseHandler):
self.wfile.write(listing)
def convertSize(self, size):
ext = None
for ext in "BKMGT":
for ext in "KMGT":
size /= 1024.0
if size < 1024.0:
break
size /= 1024.0
return (size, ext)
if ext == "K" and size < 0.1:
size = 0.1
return (size, ext.strip())
def getCleanPath(self):
urlPath = posixpath.normpath(urllib.unquote(self.path)).strip("/")