On inscrit la ML com-ens de manire "propre".
darcs-hash:20060407162708-68412-df53f8511e55b324e05614725fbb5b48ade44827.gz
This commit is contained in:
parent
fef55af5ad
commit
4eb20d7ab4
1 changed files with 21 additions and 5 deletions
|
@ -4,12 +4,22 @@
|
|||
# Copyright (C) Frédéric Pauget
|
||||
# Licence : GPLv2
|
||||
|
||||
import smtplib, sys, commands, shutil, os
|
||||
import smtplib, sys, commands, shutil, os, traceback
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
from affich_tools import cprint, anim, OK, WARNING, ERREUR
|
||||
import config
|
||||
from time import strftime
|
||||
|
||||
try:
|
||||
sys.path.append('/usr/lib/mailman')
|
||||
from Mailman.MailList import MailList
|
||||
from Mailman.UserDesc import UserDesc
|
||||
from Mailman.Errors import MMAlreadyAMember
|
||||
except:
|
||||
# Machine sans mailman, les ML ne seront pas reconfigurées
|
||||
pass
|
||||
|
||||
|
||||
class del_user:
|
||||
""" Suppression des fichiers d'un compte utilisateur """
|
||||
|
||||
|
@ -135,12 +145,18 @@ class ML_ens:
|
|||
|
||||
def reconfigure(self):
|
||||
cprint(u'Inscription ML-ENS', 'gras')
|
||||
mlist = MailList('com-ens')
|
||||
for mail in self.mails:
|
||||
anim('\t' + mail)
|
||||
status, output = commands.getstatusoutput("echo '%s' | /usr/sbin/add_members -r - com-ens >/dev/null 2>&1" % mail)
|
||||
if status:
|
||||
try:
|
||||
mlist.ApprovedAddMember(UserDesc(mail))
|
||||
except MMAlreadyAMember:
|
||||
cprint(u"DÉJÀ INSCRIT", "jaune")
|
||||
except:
|
||||
print ERREUR
|
||||
if self.debug:
|
||||
sys.stderr.write(output + '\n')
|
||||
if self.debug:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
print OK
|
||||
mlist.Save()
|
||||
mlist.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue