# HG changeset patch # User Sylvain Thénault # Date 1279183399 -7200 # Node ID 220856aff85e129c940cdd8a2c1a33b8b1f3d783 # Parent 6109bdb8ac0633cd88de6c262110ee4403d55349 [ldap] take care, email address may be a list. In such case, only consider the first one (XXX). Also, fix call to reset_caches. diff -r 6109bdb8ac06 -r 220856aff85e server/sources/ldapuser.py --- a/server/sources/ldapuser.py Tue Jul 13 17:22:15 2010 +0200 +++ b/server/sources/ldapuser.py Thu Jul 15 10:43:19 2010 +0200 @@ -232,6 +232,8 @@ if res: ldapemailaddr = res[0].get(ldap_emailattr) if ldapemailaddr: + if isinstance(ldapemailaddr, list): + ldapemailaddr = ldapemailaddr[0] # XXX consider only the first email in the list rset = execute('Any X,A WHERE ' 'X address A, U use_email X, U eid %(u)s', {'u': eid}) @@ -522,7 +524,7 @@ eid, base) entity = session.entity_from_eid(eid, 'CWUser') self.repo.delete_info(session, entity, self.uri, base) - self.reset_cache() + self.reset_caches() return [] # except ldap.REFERRAL, e: # cnx = self.handle_referral(e) @@ -589,6 +591,8 @@ emailaddr = self._cache[dn][self.user_rev_attrs['email']] except KeyError: return + if isinstance(emailaddr, list): + emailaddr = emailaddr[0] # XXX consider only the first email in the list rset = session.execute('EmailAddress X WHERE X address %(addr)s', {'addr': emailaddr}) if rset: