commit/galaxy-central: dan: Fix for nice_size formatting of negative values.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/474e6beec218/ Changeset: 474e6beec218 User: dan Date: 2015-01-21 20:16:53+00:00 Summary: Fix for nice_size formatting of negative values. Affected #: 1 file diff -r a09398a62b752f72c076fa98ccd149dc8f3050a7 -r 474e6beec218c4041b87834915ee916f10a2a27e lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -1014,8 +1014,12 @@ '95.4 MB' """ words = [ 'bytes', 'KB', 'MB', 'GB', 'TB' ] + prefix = '' try: size = float( size ) + if size < 0: + size = abs( size ) + prefix = '-' except: return '??? bytes' for ind, word in enumerate(words): @@ -1023,8 +1027,8 @@ if step > size: size = size / float(1024 ** ind) if word == 'bytes': # No decimals for bytes - return "%d bytes" % size - return "%.1f %s" % (size, word) + return "%s%d bytes" % ( prefix, size ) + return "%s%.1f %s" % ( prefix, size, word ) return '??? bytes' Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org