diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index fc02f4ec..6c1662cb 100755 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -870,7 +870,7 @@ class base_classes_crans(crans_ldap) : def _delete(self,dn,comment='') : """ Sauvegarde puis destruction du dn (et des sous-dn) fourni """ # Commentaires - comment = preattr(comment)[1] # UTF-8 + comment = preattr(comment)[1] self.modifs.append('destruction (%s)' % comment) self._save() @@ -881,7 +881,7 @@ class base_classes_crans(crans_ldap) : self.rw_conn = None cPickle.dump(self,fd,2) fd.close() - index = "%s, %s : %s %s # %s\n" % (time.strftime(date_format), script_utilisateur, t, self.Nom() , comment) + index = u"%s, %s : %s %s # %s\n" % (time.strftime(date_format), script_utilisateur, t, self.Nom() , decode(comment)) self.connect() # Reconnexion à la base # Destruction @@ -2180,3 +2180,13 @@ if __name__ == '__main__' : db = crans_ldap() db.remove_lock('*') + + if 'menage' in sys.argv : + print "Ménage des machines des adhérents partis..." + db = crans_ldap() + machines=db.search('paiement!=%s&host=*.crans.org' % ann_scol ,'w')['machine'] + print "Destruction de %i machines" % len(machines) + for m in machines : + print 'Destruction de %s' % m.nom() + m.delete('Ménage') +