# HG changeset patch # User Sylvain Thénault # Date 1448285204 -3600 # Node ID 53af91f77b9d2446af1c6f28848ee6c10e29246f # Parent f80428f9476152b5870adb676fd59a4709b1ed33 [ldapfeed] simplify deactivation of unencountered users there is no need for the by_etype intermediary dictionnary since we only consider CWUsers. diff -r f80428f94761 -r 53af91f77b9d sobjects/ldapparser.py --- a/sobjects/ldapparser.py Tue Nov 24 10:04:18 2015 +0100 +++ b/sobjects/ldapparser.py Mon Nov 23 14:26:44 2015 +0100 @@ -1,4 +1,4 @@ -# copyright 2011-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +# copyright 2011-2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of CubicWeb. @@ -100,18 +100,12 @@ super(DataFeedLDAPAdapter, self).handle_deletion(config, cnx, myuris) return if myuris: - byetype = {} for extid, (eid, etype) in myuris.items(): - if self.is_deleted(extid, etype, eid): - byetype.setdefault(etype, []).append(str(eid)) - - for etype, eids in byetype.items(): - if etype != 'CWUser': + if etype != 'CWUser' or not self.is_deleted(extid, etype, eid): continue - self.info('deactivate %s %s entities', len(eids), etype) - for eid in eids: - wf = cnx.entity_from_eid(eid).cw_adapt_to('IWorkflowable') - wf.fire_transition_if_possible('deactivate') + self.info('deactivate user %s', eid) + wf = cnx.entity_from_eid(eid).cw_adapt_to('IWorkflowable') + wf.fire_transition_if_possible('deactivate') cnx.commit() def update_if_necessary(self, entity, attrs):