diff --git a/admin/menage_cableurs.py b/admin/menage_cableurs.py index 594d0fae..de246343 100755 --- a/admin/menage_cableurs.py +++ b/admin/menage_cableurs.py @@ -63,17 +63,20 @@ def _controle_interactif_adherents(liste): cprint(u'Arrêt du contrôle %s des membres actifs' % explicite, 'rouge') break - +def candidats(): + todo_list1 = db.search('droits=*')['adherent'] + todo_list = [] + for adh in todo_list1: + if ('Bureau' not in adh.droits()) and ('Nounou' not in adh.droits()) and ('Apprenti' not in adh.droits()) and (adh.droits()!=['MultiMachines']) and (config.ann_scol not in adh.paiement()): + todo_list.append(adh) + todo_list.sort(lambda x, y: cmp((x.nom(), x.prenom()), (y.nom(), y.prenom()))) + return todo_list + def lister(): """ Afficher les câbleurs fantômes potentiels. """ - todo_list1 = db.search('droits=*')['adherent'] - todo_list = [] - for adh in todo_list1: - if ('Bureau' not in adh.droits()) and ('Nounou' not in adh.droits()) and (adh.droits()!=['MultiMachines']) and (config.ann_scol not in adh.paiement()): - todo_list.append(adh) - todo_list.sort(lambda x, y: cmp((x.nom(), x.prenom()), (y.nom(), y.prenom()))) + todo_list = candidats() print "Liste des câbleur dont la cotisation n'est pas à jour." print for adh in todo_list: @@ -85,16 +88,8 @@ def controle_interactif(): """ Procédure interactive de radiations des câbleurs fantômes. """ - todo_list1 = db.search('droits=*')['adherent'] - todo_list = [] - for adh in todo_list1: - if ('Bureau' not in adh.droits()) and ('Nounou' not in adh.droits()) and (adh.droits()!=['MultiMachines']) and (config.ann_scol not in adh.paiement()): - todo_list.append(adh) + todo_list = candidats() - # Tri de la liste des adhérents selon nom, prénom - # Ça peut se faire plus facilement en Python 2.4 avec l'argument key - todo_list.sort(lambda x, y: cmp((x.nom(), x.prenom()), (y.nom(), y.prenom()))) - # Zou ! _controle_interactif_adherents(todo_list)