summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-07 12:46:08 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-07 13:14:41 +0100
commit0011c58cb6d3171912ce2b97b40f0e1285898371 (patch)
treef949d2dcc2454fe98d0c6772f7f9685beb06ba9a /pykolab
parent729ef57b9d88fa8dd576c2dead454b2097ab5f13 (diff)
downloadpykolab-0011c58cb6d3171912ce2b97b40f0e1285898371.tar.gz
Clause cmd_list_quota to accept there may be no quota at all
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/cli/cmd_list_quota.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/pykolab/cli/cmd_list_quota.py b/pykolab/cli/cmd_list_quota.py
index d71f272..dfd8b75 100644
--- a/pykolab/cli/cmd_list_quota.py
+++ b/pykolab/cli/cmd_list_quota.py
@@ -54,11 +54,17 @@ def execute(*args, **kw):
for quota_folder in quota_folders:
try:
(used, quota) = imap.get_quota(quota_folder)
- percentage = round((used/quota)*100, 1)
- print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
+ if not used == None and not quota == None:
+ percentage = round((used/quota)*100, 1)
+ print "%d (Used: %d, Percentage: %d)" % (quota, used, percentage)
+ else:
+ print "No quota"
except:
(quota_root, used, quota) = imap.get_quota_root(quota_folder)
- percentage = round((used/quota)*100, 1)
- print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
+ if not quota_root == None and not used == None and not quota == None:
+ percentage = round((used/quota)*100, 1)
+ print "%d (Root: %s, Used: %d, Percentage: %d)" % (quota, quota_root, used, percentage)
+ else:
+ print "No quota"