C'est plus propre comme cela.
darcs-hash:20041005181607-41617-c7a996b5708a1b84e25039e3c23117f94b9626dc.gz
This commit is contained in:
parent
5bd806ea3b
commit
af963b9451
1 changed files with 28 additions and 18 deletions
|
@ -132,32 +132,42 @@ exit
|
||||||
""" Recontigure la chambre fournie chambre """
|
""" Recontigure la chambre fournie chambre """
|
||||||
try :
|
try :
|
||||||
bat = chbre[0].lower()
|
bat = chbre[0].lower()
|
||||||
prise = sw_chbre(chbre)
|
if bat in bat_switchs :
|
||||||
prise.reconfigure() # Vitesse et nom (juste au cas ou ca aurait changé)
|
prise = sw_chbre(chbre)
|
||||||
|
prise.reconfigure() # Vitesse et nom (juste au cas ou ca aurait changé)
|
||||||
|
else :
|
||||||
|
class prise_non_manageable :
|
||||||
|
def __init__(self,chbre) :
|
||||||
|
self.chbre = chbre
|
||||||
|
|
||||||
|
def __mail(sujet) :
|
||||||
|
To = "clef%s@crans.org" % self.chbre[0].lower()
|
||||||
|
From = To
|
||||||
|
conn=smtplib.SMTP('localhost')
|
||||||
|
txt_mail = "From: Crans scripts <%(From)s>\n"
|
||||||
|
txt_mail+= "To: %(To)s\n"
|
||||||
|
txt_mail+= "Subject: (CRANS) %s\n\nMerci." % sujet
|
||||||
|
conn.sendmail(From, To , txt_mail % { 'From' : From, 'To' : To })
|
||||||
|
conn.quit()
|
||||||
|
|
||||||
|
def disable() :
|
||||||
|
self.__mail("Chambre %s à débrancher." % self.chbre)
|
||||||
|
def enable() :
|
||||||
|
self.__mail("Chambre %s à brancher." % self.chbre)
|
||||||
|
|
||||||
|
prise=prise_non_manageable(chbre)
|
||||||
|
|
||||||
a = self.db.search('chbre=%s&paiement=ok' % chbre)
|
a = self.db.search('chbre=%s&paiement=ok' % chbre)
|
||||||
a = a['adherent'] + a['club']
|
a = a['adherent'] + a['club']
|
||||||
sujet = ''
|
|
||||||
if a and 'bloq' not in a[0].blacklist_actif() :
|
if a and 'bloq' not in a[0].blacklist_actif() :
|
||||||
# Il faut activer la prise
|
# Il faut activer la prise
|
||||||
anim('\tactivation chbre %s' % chbre)
|
anim('\tactivation chbre %s' % chbre)
|
||||||
if bat in bat_switchs : prise.enable()
|
prise.enable()
|
||||||
else : sujet = "Chambre %s à brancher." % chbre
|
|
||||||
else :
|
else :
|
||||||
# Il faut désactiver la prise
|
# Il faut désactiver la prise
|
||||||
anim('\tdésactivation chbre %s' % chbre)
|
anim('\tdésactivation chbre %s' % chbre)
|
||||||
if bat in bat_switchs : prise.disable()
|
prise.disable()
|
||||||
else : sujet = "Chambre %s à débrancher." % chbre
|
|
||||||
|
|
||||||
if sujet :
|
|
||||||
# Il faut envoyer un mail
|
|
||||||
To = "clef%s@crans.org" % bat
|
|
||||||
From = To
|
|
||||||
conn=smtplib.SMTP('localhost')
|
|
||||||
txt_mail = "From: Crans scripts <%(From)s>\n"
|
|
||||||
txt_mail+= "To: %(To)s\n"
|
|
||||||
txt_mail+= "Subject: (CRANS) %s\n\nMerci." % sujet
|
|
||||||
conn.sendmail(From, To , txt_mail % { 'From' : From, 'To' : To })
|
|
||||||
conn.quit()
|
|
||||||
print OK
|
print OK
|
||||||
except :
|
except :
|
||||||
print ERREUR
|
print ERREUR
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue