chambres_vides: utilisation d'un contexte lc_ldap

This commit is contained in:
Daniel STAN 2014-03-15 15:37:45 +01:00
parent fc5a4f0a86
commit a575c7f07b

View file

@ -81,8 +81,9 @@ for clandestin in bad_boys_e_s:
else: else:
for m in machine_liste: for m in machine_liste:
try: try:
m2 = conn.search(u'mid=%s' % m['mid'][0],mode='w')[0] reason = u'Adhérent sans chambre valide depuis %d jours' % delai
m2.delete('Adherent sans chambre valide depuis %d jours' % delai) with conn.search(u'mid=%s' % m['mid'][0], mode='w')[0] as m2:
m2.delete(reason)
to_print.append( (clandestin['aid'][0], m['ipHostNumber'][0], m['mid'][0], m['host'][0]) ) to_print.append( (clandestin['aid'][0], m['ipHostNumber'][0], m['mid'][0], m['host'][0]) )
except Exception as e: except Exception as e:
to_error.append((clandestin['aid'][0], m['ipHostNumber'][0], m['mid'][0], m['host'][0], e)) to_error.append((clandestin['aid'][0], m['ipHostNumber'][0], m['mid'][0], m['host'][0], e))