[ldapfeed] don't crash if entity is None. Closes (superficialy) #2341266

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changeset76c7149d9076
branchdefault
phasepublic
hiddenno
parent revision#a682f5cb73f6 [merge] backport stable fixes
child revision#3f34d69e0c22 [yams] Binary instance passwords should not be given to str()
files modified by this revision
sobjects/ldapparser.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1336052758 -7200
# Thu May 03 15:45:58 2012 +0200
# Node ID 76c7149d90768572f93048054eed34d25c80b7d1
# Parent a682f5cb73f6cf11beca603a9b5c714b60fdb981
[ldapfeed] don't crash if entity is None. Closes (superficialy) #2341266

diff --git a/sobjects/ldapparser.py b/sobjects/ldapparser.py
@@ -41,11 +41,11 @@
1          except KeyError:
2              ldap_emailattr = None
3          for userdict in source._search(self._cw, source.user_base_dn,
4                                         source.user_base_scope, searchstr):
5              entity = self.extid2entity(userdict['dn'], 'CWUser', **userdict)
6 -            if not self.created_during_pull(entity):
7 +            if entity is not None and not self.created_during_pull(entity):
8                  self.notify_updated(entity)
9                  attrs = self.ldap2cwattrs(userdict)
10                  self.update_if_necessary(entity, attrs)
11                  self._process_email(entity, userdict)
12