summaryrefslogtreecommitdiffstats
path: root/pykolab
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:42:58 +0100
commitca36ac058d4a324749667f9e37c68eef31ef422a (patch)
tree4998df1b4c54aa220bb602f142a5773c61f3e566 /pykolab
parent3bcd1633493b7f0891ed333a035d1120fa12c073 (diff)
downloadpykolab-ca36ac058d4a324749667f9e37c68eef31ef422a.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')
-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"