Branch 'pykolab-0.5' - pykolab/cli

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Mon Sep 17 19:35:00 CEST 2012


 pykolab/cli/cmd_list_quota.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 11408ada162194049823c35099f87575e1fdfd24
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Mon Sep 17 18:34:40 2012 +0100

    Make integers be floats before we make the division

diff --git a/pykolab/cli/cmd_list_quota.py b/pykolab/cli/cmd_list_quota.py
index fece3c3..c81725a 100644
--- a/pykolab/cli/cmd_list_quota.py
+++ b/pykolab/cli/cmd_list_quota.py
@@ -59,7 +59,7 @@ def execute(*args, **kw):
                     print >> sys.stderr, _("The quota for folder %s is set to literally allow 0KB of storage.") % (quota_folder)
                     print "%d (Used: %d, Percentage: %s)" % (quota, used, u'\u221E')
                 else:
-                    percentage = round((used/quota)*100, 1)
+                    percentage = round(((float)(used)/(float)(quota)) * 100.0, 1)
                     print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
             else:
                 print "No quota"
@@ -69,9 +69,9 @@ def execute(*args, **kw):
                 if not quota_root == None and not used == None and not quota == None:
                     if quota == 0:
                         print >> sys.stderr, _("The quota for folder %s is set to literally allow 0KB of storage.") % (quota_folder)
-                        print "%d (Used: %d, Percentage: %s)" % (quota, used, u'\u221E')
+                        print "%d (Used: %d, Percentage: %d)" % (quota, used, u'\u221E')
                     else:
-                        percentage = round((used/quota)*100, 1)
+                        percentage = round(((float)(used)/(float)(quota)) * 100.0, 1)
                         print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
                 else:
                     print "No quota"





More information about the commits mailing list