summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-12-20 19:05:17 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-12-20 19:06:43 +0100
commitfca43510f4a2380eb51957de43293154313ce909 (patch)
tree0ea96bc7fd0d828f3e8f6f98478a37fb51807505
parentdad1f283a6ac83d2486048e3d06beb8a1bc8c82e (diff)
downloadpykolab-fca43510f4a2380eb51957de43293154313ce909.tar.gz
Avoid trickery in the annotation name and shared namespace
-rw-r--r--pykolab/imap/cyrus.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/pykolab/imap/cyrus.py b/pykolab/imap/cyrus.py
index 31f245c..bf1b8a4 100644
--- a/pykolab/imap/cyrus.py
+++ b/pykolab/imap/cyrus.py
@@ -190,23 +190,41 @@ class Cyrus(cyruslib.CYRUS):
max_tries = 20
num_try = 0
+
+ ann_path = "/vendor/cmu/cyrus-imapd/server"
+ s_ann_path = "/shared%s" % (ann_path)
+
while 1:
num_try += 1
- annotations = self._getannotation(mailfolder, "/vendor/cmu/cyrus-imapd/server")
+ annotations = self._getannotation(
+ mailfolder,
+ ann_path
+ )
if annotations.has_key(mailfolder):
- break
+ if annotations[mailfolder].has_key(s_ann_path):
+ break
if max_tries <= num_try:
- log.error(_("Could not get the annotations after %s tries.") % (num_try))
- annotations = { mailfolder: { '/shared/vendor/cmu/cyrus-imapd/server': self.server }}
+ log.error(
+ _("Could not get the annotations after %s tries.") % (
+ num_try
+ )
+ )
+
+ annotations = {
+ mailfolder: {
+ s_ann_path: self.server
+ }
+ }
+
break
log.warning(_("No annotations for %s: %r") % (mailfolder,annotations))
time.sleep(1)
- server = annotations[mailfolder]['/shared/vendor/cmu/cyrus-imapd/server']
+ server = annotations[mailfolder][s_ann_path]
self.mbox[mailfolder] = server
log.debug(_("Server for INBOX folder %s is %s") % (mailfolder,server), level=8)