pykolab/auth
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Thu Jun 5 14:24:45 CEST 2014
pykolab/auth/ldap/cache.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
New commits:
commit 8678e417a9cdb7c65c6ebc0c70ab65b79475af68
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Jun 5 14:24:29 2014 +0200
Only compare result attribute values if indeed the input has such key
diff --git a/pykolab/auth/ldap/cache.py b/pykolab/auth/ldap/cache.py
index ad50e9b..9be4c3e 100644
--- a/pykolab/auth/ldap/cache.py
+++ b/pykolab/auth/ldap/cache.py
@@ -150,11 +150,12 @@ def get_entry(domain, entry, update=True):
db.commit()
_entry = db.query(Entry).filter_by(uniqueid=entry['id']).first()
- if not _entry.result_attribute == entry[result_attribute]:
- log.debug(_("Updating result_attribute for cache entry %r") % (entry['id']), level=8)
- _entry.result_attribute = entry[result_attribute]
- db.commit()
- _entry = db.query(Entry).filter_by(uniqueid=entry['id']).first()
+ if entry.has_key(result_attribute):
+ if not _entry.result_attribute == entry[result_attribute]:
+ log.debug(_("Updating result_attribute for cache entry %r") % (entry['id']), level=8)
+ _entry.result_attribute = entry[result_attribute]
+ db.commit()
+ _entry = db.query(Entry).filter_by(uniqueid=entry['id']).first()
return _entry
More information about the commits
mailing list