3 commits - pykolab/auth
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Thu May 10 17:45:22 CEST 2012
pykolab/auth/ldap/__init__.py | 17 +++++++++++++----
pykolab/auth/ldap/cache.py | 5 +++--
2 files changed, 16 insertions(+), 6 deletions(-)
New commits:
commit 280425b764f4d9524251904d69dc559cba2f3838
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu May 10 16:39:52 2012 +0100
Add back the cache.get_entry() routine
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 4cbe02d..b55af52 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1086,7 +1086,7 @@ class LDAP(pykolab.base.Base):
for key in rcpt_addrs.keys():
entry[key] = rcpt_addrs[key]
- #cache.get_entry(self.domain, entry)
+ cache.get_entry(self.domain, entry)
self.imap.connect(domain=self.domain)
commit 119c93df239dfbb451662e1e6cef2ee53129dd54
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu May 10 16:39:08 2012 +0100
Do not attempt to create a mailbox if no value for the result attribute we're looking for exists (#750)
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index fc670fa..4cbe02d 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1090,9 +1090,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()
commit c1bb1dd576a8d6791986da8aaf1517cd8bae225a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu May 10 16:38:07 2012 +0100
Correct cache.get_entry() use of strtime (should have been strftime) and Python native datetime objects (we were passing the literal string)
diff --git a/pykolab/auth/ldap/cache.py b/pykolab/auth/ldap/cache.py
index 844c3cf..8bdeebe 100644
--- a/pykolab/auth/ldap/cache.py
+++ b/pykolab/auth/ldap/cache.py
@@ -118,9 +118,10 @@ def get_entry(domain, entry):
db.commit()
_entry = db.query(Entry).filter_by(uniqueid=entry['id']).first()
else:
- if not _entry.last_change.strtime("%Y%m%d%H%M%SZ") == entry['modifytimestamp']:
+ if not _entry.last_change.strftime("%Y%m%d%H%M%SZ") == entry['modifytimestamp']:
log.debug(_("Updating timestamp for cache entry %r") % (entry['id']), level=8)
- entry.last_change = entry['modifytimestamp']
+ last_change = datetime.datetime.strptime(entry['modifytimestamp'], "%Y%m%d%H%M%SZ")
+ _entry.last_change = last_change
db.commit()
_entry = db.query(Entry).filter_by(uniqueid=entry['id']).first()
More information about the commits
mailing list