diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-09-07 12:46:08 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-09-07 12:46:08 +0100 |
commit | e75cdfa0a320bcb58dc6abbb23c558a4e0035f63 (patch) | |
tree | 5dd33fb12366577ec17e1fac54460ba09b7c1c6e | |
parent | 14fe4361062e958ad9a782667c5e6630f666f6e7 (diff) | |
download | pykolab-e75cdfa0a320bcb58dc6abbb23c558a4e0035f63.tar.gz |
Clause cmd_list_quota to accept there may be no quota at all
-rw-r--r-- | pykolab/cli/cmd_list_quota.py | 14 |
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" |