Merge lp:~cruzjbishop/loggerhead/proper-size-display into lp:loggerhead

Proposed by Cruz Bishop
Status: Merged
Approved by: j.c.sackett
Approved revision: 476
Merged at revision: 475
Proposed branch: lp:~cruzjbishop/loggerhead/proper-size-display
Merge into: lp:loggerhead
Diff against target: 28 lines (+5/-5)
1 file modified
loggerhead/util.py (+5/-5)
To merge this branch: bzr merge lp:~cruzjbishop/loggerhead/proper-size-display
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Richard Harding (community) code* Approve
Review via email: mp+103587@code.launchpad.net

Commit message

Better formatting of file sizes, and show empty files as empty

Description of the change

Shows empty files as 'Empty' instead of '0'

Better formatting of file sizes - see http://imgur.com/a/SbHTW

To post a comment you must log in.
Revision history for this message
Richard Harding (rharding) wrote :

Thanks for the update.

review: Approve (code*)
Revision history for this message
j.c.sackett (jcsackett) :
review: Approve
Revision history for this message
Cruz Bishop (cruzjbishop) wrote :

Any time :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/util.py'
2--- loggerhead/util.py 2012-02-08 01:50:02 +0000
3+++ loggerhead/util.py 2012-04-25 23:43:18 +0000
4@@ -332,9 +332,9 @@
5 def human_size(size, min_divisor=0):
6 size = int(size)
7 if (size == 0) and (min_divisor == 0):
8- return '0'
9+ return 'Empty'
10 if (size < 512) and (min_divisor == 0):
11- return str(size)
12+ return str(size) + ' bytes'
13
14 if (size >= P95_GIG) or (min_divisor >= GIG):
15 divisor = GIG
16@@ -355,11 +355,11 @@
17 if (base < 100) and (dot != 0):
18 out += '.%d' % (dot,)
19 if divisor == KILO:
20- out += 'K'
21+ out += ' KB'
22 elif divisor == MEG:
23- out += 'M'
24+ out += ' MB'
25 elif divisor == GIG:
26- out += 'G'
27+ out += ' GB'
28 return out
29
30

Subscribers

People subscribed via source and target branches