summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2020-01-13 14:10:36 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2020-01-13 14:11:59 +0100
commitd51ded2cb93fadb51322fa300232402e97310e27 (patch)
treeebbf0ffd0632371e9751b77fa69f9ab730e4646f /pykolab
parent5c4678f02488845d7a8d256ef2129b36b1101c97 (diff)
downloadpykolab-d51ded2cb93fadb51322fa300232402e97310e27.tar.gz
Fix AttributeError: Cyrus instance has no attribute 'has_folder' in cleanup_acls()
Summary: Also improve performance by removing has_folder() check, and removed redundant debug code Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Subscribers: vanmeeuwen Differential Revision: https://git.kolab.org/D823
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/imap/__init__.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 3fc72d3..b5aff55 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -43,14 +43,13 @@ class IMAP(object):
self.imap = None
def cleanup_acls(self, aci_subject):
- lm_suffix = ""
-
log.info(
_("Cleaning up ACL entries for %s across all folders") % (
aci_subject
)
)
+ lm_suffix = ""
if len(aci_subject.split('@')) > 1:
lm_suffix = "@%s" % (aci_subject.split('@')[1])
@@ -58,13 +57,6 @@ class IMAP(object):
user_folders = self.imap.lm("user/*%s" % (lm_suffix))
- log.debug(
- _("Cleaning up ACL entries referring to identifier %s") % (
- aci_subject
- ),
- level=5
- )
-
# For all folders (shared and user), ...
folders = user_folders + shared_folders
@@ -72,8 +64,8 @@ class IMAP(object):
# ... loop through them and ...
for folder in folders:
- # ... list the ACL entries -- but only if the folder still exists
- if self.imap.has_folder(folder):
+ try:
+ # ... list the ACL entries
acls = self.imap.lam(folder)
# For each ACL entry, see if we think it is a current, valid
@@ -96,13 +88,13 @@ class IMAP(object):
)
self.set_acl(folder, acl_entry, '')
- else:
- log.debug(
- _("Folder %r disappeared (ACL cleanup for %r") % (
+
+ except Exception, errmsg:
+ log.error(
+ _("Failed to read/set ACL on folder %s: %r") % (
folder,
- aci_subject
- ),
- level=8
+ errmsg
+ )
)
def connect(self, uri=None, server=None, domain=None, login=True):