summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-10 16:39:08 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-10 16:39:08 +0100
commitdbdff396e1b029f9525f609e2947dffbc748efd7 (patch)
tree6f520ad6a5bbf06c0e5a7a5784b656dc815a0b71 /pykolab
parent4099ec6f9880814bec528fb5a2967b66ae6dd3a0 (diff)
downloadpykolab-dbdff396e1b029f9525f609e2947dffbc748efd7.tar.gz
Do not attempt to create a mailbox if no value for the result attribute we're looking for exists (#750)
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/ldap/__init__.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 2f01ba3..5793dc5 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1080,9 +1080,18 @@ class LDAP(pykolab.base.Base):
self.imap.connect(domain=self.domain)
- if not self.imap.user_mailbox_exists(entry[result_attribute]):
- folder = self.imap.user_mailbox_create(entry[result_attribute])
- server = self.imap.user_mailbox_server(folder)
+ if entry.has_key(result_attribute) and not entry.has_key(result_attribute) == None:
+ if not self.imap.user_mailbox_exists(entry[result_attribute]):
+ folder = self.imap.user_mailbox_create(entry[result_attribute])
+ server = self.imap.user_mailbox_server(folder)
+
+ else:
+ log.warning(
+ _("Kolab user %s does not have a result attribute %r") % (
+ entry['id'],
+ result_attribute
+ )
+ )
def _disconnect(self):
self._unbind()