summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2017-02-22 13:45:10 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2017-02-22 13:45:10 +0100
commitc76537295c900d30046b5655c76d503a2be87450 (patch)
tree6e9e154e3b6733bcc5adbe4abc0bc7eb85459644
parent8a2e225b56551f55100bdaf040606de1cb7c32cf (diff)
downloadpykolab-c76537295c900d30046b5655c76d503a2be87450.tar.gz
Allow a folder we intend to clean up the ACL entries for, to have disappeared by the time we get around to it.
Reference bifrost#T14032
-rw-r--r--pykolab/imap/__init__.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 335da8b..1dc64ed 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -72,17 +72,20 @@ class IMAP(object):
# ... loop through them and ...
for folder in folders:
- # ... list the ACL entries
- acls = self.imap.lam(folder)
-
- # For each ACL entry, see if we think it is a current, valid entry
- for acl_entry in acls.keys():
- # If the key 'acl_entry' does not exist in the dictionary of valid
- # ACL entries, this ACL entry has got to go.
- if acl_entry == aci_subject:
- # Set the ACL to '' (effectively deleting the ACL entry)
- log.debug(_("Removing acl %r for subject %r from folder %r") % (acls[acl_entry],acl_entry,folder), level=8)
- self.set_acl(folder, acl_entry, '')
+ # ... list the ACL entries -- but only if the folder still exists
+ if self.imap.has_folder(folder):
+ acls = self.imap.lam(folder)
+
+ # For each ACL entry, see if we think it is a current, valid entry
+ for acl_entry in acls.keys():
+ # If the key 'acl_entry' does not exist in the dictionary of valid
+ # ACL entries, this ACL entry has got to go.
+ if acl_entry == aci_subject:
+ # Set the ACL to '' (effectively deleting the ACL entry)
+ log.debug(_("Removing acl %r for subject %r from folder %r") % (acls[acl_entry],acl_entry,folder), level=8)
+ self.set_acl(folder, acl_entry, '')
+ else:
+ log.debug(_("Folder %r disappeared (ACL cleanup for %r") % (folder, subject), level=8)
def connect(self, uri=None, server=None, domain=None, login=True):
"""