diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py --- a/pykolab/imap/__init__.py +++ b/pykolab/imap/__init__.py @@ -43,14 +43,13 @@ 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 @@ 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 @@ # ... 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 @@ ) 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):