summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-07-31 16:11:00 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-07-31 16:11:00 +0200
commitb24bd6f245b9527592ce0fcfbc67bb0a145c1b8c (patch)
tree947829abffc97b0ad84a99aa31dc543d3a816459
parent9269176584e5a425a6336b8c83deff5601bd932d (diff)
downloadpykolab-b24bd6f245b9527592ce0fcfbc67bb0a145c1b8c.tar.gz
Escape type errors
If a user is modified, but already has a result_attribute value, still create the mailbox if it doesn't already exist
-rw-r--r--pykolab/auth/ldap/__init__.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index f823d46..6b9f56c 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -176,7 +176,10 @@ class LDAP(pykolab.base.Base):
log.error(_("Authentication cache failed: %r") % (errmsg))
pass
- user_filter = self.config_get_raw('user_filter') % ({'base_dn':base_dn})
+ try:
+ user_filter = self.config_get_raw('user_filter') % ({'base_dn':base_dn})
+ except TypeError, errmsg:
+ user_filter = self.config_get_raw('user_filter')
_filter = '(&(|'
@@ -1798,8 +1801,24 @@ class LDAP(pykolab.base.Base):
)
cache.get_entry(self.domain, entry)
+ else:
+ imap_mailbox = "user%s%s" % (
+ self.imap.get_separator(),
+ entry[result_attribute]
+ )
+
+ if not self.imap.has_folder(imap_mailbox):
+ self.imap_user_mailbox_create(
+ entry[result_attribute]
+ )
- self.user_quota(entry, "user%s%s" % (self.imap.get_separator(),entry[result_attribute]))
+ self.user_quota(
+ entry,
+ "user%s%s" % (
+ self.imap.get_separator(),
+ entry[result_attribute]
+ )
+ )
if conf.has_option(self.domain, 'sieve_mgmt'):
sieve_mgmt_enabled = conf.get(self.domain, 'sieve_mgmt')