server/sources/ldapuser.py
changeset 5972 220856aff85e
parent 5856 a02129508378
child 6142 8bc6eac1fac1
child 6728 f68bd4c876d1
--- 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: