deconnexion: utilise send_template
Ce qui évite d'envoyer des mails à None.
This commit is contained in:
parent
b14847c625
commit
246cba6107
1 changed files with 9 additions and 10 deletions
|
@ -301,18 +301,17 @@ def upload_hard(proprio, elupload, elid, eltype, curseur, ldap):
|
||||||
# On envoie un mail à disconnect
|
# On envoie un mail à disconnect
|
||||||
################################
|
################################
|
||||||
with mail_module.ServerConnection() as smtp_conn:
|
with mail_module.ServerConnection() as smtp_conn:
|
||||||
corps = mail_module.generate('upload_hard', mail_data).as_string()
|
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
smtp_conn.sendmail(upload.expediteur, unicode(proprio.get_mail()), corps)
|
smtp_conn.send_template('upload_hard', mail_data)
|
||||||
else:
|
else:
|
||||||
print corps
|
print mail_module.generate('upload_hard', mail_data).as_string()
|
||||||
|
|
||||||
|
# Et on s'envoie un mail de notif
|
||||||
mail_data['to'] = upload.expediteur
|
mail_data['to'] = upload.expediteur
|
||||||
corps = mail_module.generate('upload_notif', mail_data).as_string()
|
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
smtp_conn.sendmail(upload.expediteur, upload.expediteur, corps)
|
smtp_conn.send_template('upload_notif', mail_data)
|
||||||
else:
|
else:
|
||||||
print corps
|
print mail_module.generate('upload_notif', mail_data).as_string()
|
||||||
|
|
||||||
def upload_soft(proprio, elupload, elid, eltype, curseur):
|
def upload_soft(proprio, elupload, elid, eltype, curseur):
|
||||||
"""Envoit un mail et stocke l'info"""
|
"""Envoit un mail et stocke l'info"""
|
||||||
|
@ -324,7 +323,7 @@ def upload_soft(proprio, elupload, elid, eltype, curseur):
|
||||||
# On envoie un mail à l'adhérent
|
# On envoie un mail à l'adhérent
|
||||||
################################
|
################################
|
||||||
with mail_module.ServerConnection() as smtp_connect:
|
with mail_module.ServerConnection() as smtp_connect:
|
||||||
corps = mail_module.generate('upload_soft', {
|
mail_data = {
|
||||||
'from': upload.expediteur,
|
'from': upload.expediteur,
|
||||||
'to': unicode(proprio.get_mail()),
|
'to': unicode(proprio.get_mail()),
|
||||||
'upload': "%.2f" % (elupload,),
|
'upload': "%.2f" % (elupload,),
|
||||||
|
@ -332,11 +331,11 @@ def upload_soft(proprio, elupload, elid, eltype, curseur):
|
||||||
'lang_info':'English version below',
|
'lang_info':'English version below',
|
||||||
'limite_soft': upload.soft,
|
'limite_soft': upload.soft,
|
||||||
'limite_hard': upload.hard,
|
'limite_hard': upload.hard,
|
||||||
}).as_string()
|
}
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
smtp_connect.sendmail(upload.expediteur, unicode(proprio.get_mail()), corps)
|
smtp_connect.send_template('upload_soft', mail_data)
|
||||||
else:
|
else:
|
||||||
print corps
|
print mail_module.generate('upload_soft', mail_data).as_string()
|
||||||
|
|
||||||
def single_check(eltype, elid, elupload, ldap, curseur):
|
def single_check(eltype, elid, elupload, ldap, curseur):
|
||||||
"""Fait un test sur un utilisateur, et
|
"""Fait un test sur un utilisateur, et
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue