[PATCH 1/2] If size is an integer value, show it as an integer value
Vratislav Podzimek
vpodzime at redhat.com
Tue Apr 22 14:44:16 UTC 2014
No point in showing 500.0 instead of 500.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
blivet/size.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/blivet/size.py b/blivet/size.py
index 1db03d3..886278d 100644
--- a/blivet/size.py
+++ b/blivet/size.py
@@ -308,6 +308,7 @@ class Size(Decimal):
# less than 10 KiB
return "%s %s" % (in_bytes, _("B"))
+
retval = newcheck
if places is not None:
retval = round(newcheck, places)
@@ -319,6 +320,10 @@ class Size(Decimal):
limit = max_places
retval = round(newcheck, limit)
+ if retval == int(retval):
+ # integer value, no point in showing ".0" at the end
+ retval = int(retval)
+
# Format the value with '.' as the decimal separator
# If necessary, substitute with a localized separator before returning
retval_str = str(retval)
--
1.9.0
More information about the anaconda-patches
mailing list