summaryrefslogtreecommitdiffstats
path: root/pykolab/cli/cmd_list_quota.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-14 12:41:51 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-14 12:41:51 +0100
commit12ca626d2e928e8dbad888e738805e4274f70b08 (patch)
treeffb3e654606644e482c951b661f632a99fe99d0d /pykolab/cli/cmd_list_quota.py
parent319095b31f77403f2ac114b0c00887e4f19c256a (diff)
downloadpykolab-12ca626d2e928e8dbad888e738805e4274f70b08.tar.gz
Resolve #1006:
- Clause getting a quota root as it is not necessary for a quota root to even exist. - Clause receiving a response of (None, None, None) before applying any math.
Diffstat (limited to 'pykolab/cli/cmd_list_quota.py')
-rw-r--r--pykolab/cli/cmd_list_quota.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/pykolab/cli/cmd_list_quota.py b/pykolab/cli/cmd_list_quota.py
index c60f48e..fece3c3 100644
--- a/pykolab/cli/cmd_list_quota.py
+++ b/pykolab/cli/cmd_list_quota.py
@@ -64,15 +64,17 @@ def execute(*args, **kw):
else:
print "No quota"
except:
- (quota_root, used, quota) = imap.get_quota_root(quota_folder)
- 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')
+ try:
+ (quota_root, used, quota) = imap.get_quota_root(quota_folder)
+ 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')
+ else:
+ percentage = round((used/quota)*100, 1)
+ print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
else:
- percentage = round((used/quota)*100, 1)
- print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
- else:
- print "No quota"
-
+ print "No quota"
+ except:
+ print "No quota root"