equal
deleted
inserted
replaced
17 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
17 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
18 WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
19 WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
20 FOR A PARTICULAR PURPOSE. |
20 FOR A PARTICULAR PURPOSE. |
21 """ |
21 """ |
|
22 |
|
23 from base64 import b64decode |
22 |
24 |
23 from logilab.common.textutils import get_csv |
25 from logilab.common.textutils import get_csv |
24 from rql.nodes import Relation, VariableRef, Constant, Function |
26 from rql.nodes import Relation, VariableRef, Constant, Function |
25 |
27 |
26 import ldap |
28 import ldap |
164 return # no email in ldap, we're done |
166 return # no email in ldap, we're done |
165 session = self.repo.internal_session() |
167 session = self.repo.internal_session() |
166 try: |
168 try: |
167 cursor = session.system_sql("SELECT eid, extid FROM entities WHERE " |
169 cursor = session.system_sql("SELECT eid, extid FROM entities WHERE " |
168 "source='%s'" % self.uri) |
170 "source='%s'" % self.uri) |
169 for eid, extid in cursor.fetchall(): |
171 for eid, b64extid in cursor.fetchall(): |
|
172 extid = b64decode(b64extid) |
170 # if no result found, _search automatically delete entity information |
173 # if no result found, _search automatically delete entity information |
171 res = self._search(session, extid, BASE) |
174 res = self._search(session, extid, BASE) |
172 if res: |
175 if res: |
173 ldapemailaddr = res[0].get(ldap_emailattr) |
176 ldapemailaddr = res[0].get(ldap_emailattr) |
174 if ldapemailaddr: |
177 if ldapemailaddr: |