[print_status] ajout de la date du mail
Flemme de rendre ça compatible avec utils.sendmail
This commit is contained in:
parent
342f020fcd
commit
cbdb32023c
1 changed files with 11 additions and 4 deletions
|
@ -14,13 +14,14 @@ License : BSD 2 clauses.
|
|||
"""
|
||||
|
||||
import sys, os
|
||||
sys.path.append("/usr/scripts/gestion")
|
||||
sys.path.append("/usr/scripts")
|
||||
|
||||
import time
|
||||
import httplib2
|
||||
import re
|
||||
import smtplib
|
||||
from ldap_crans import crans_ldap
|
||||
from gestion.ldap_crans import crans_ldap
|
||||
from email.Utils import formatdate
|
||||
|
||||
last_print_filename = "/usr/scripts/var/print_status/last_print.txt"
|
||||
error_filename = "/usr/scripts/var/print_status/error.txt"
|
||||
|
@ -35,6 +36,7 @@ Content-Transfer-Encoding: quoted-printable
|
|||
From: %s
|
||||
To: %s
|
||||
Subject: [Impression] Impression de "%s" terminée.
|
||||
Date: %s
|
||||
X-Mailer: /usr/scripts/impression/print_status.py
|
||||
|
||||
Bonjour %s,
|
||||
|
@ -56,6 +58,7 @@ Content-Disposition: inline
|
|||
From: %s
|
||||
To: %s
|
||||
Subject: [Impression][print_status.py] Impression potentiellement échouée.
|
||||
Date: %s
|
||||
X-Mailer: /usr/scripts/impression/print_status.py
|
||||
|
||||
Il semble y avoir eu un problème avec l'impression du fichier
|
||||
|
@ -188,10 +191,14 @@ for item in tasks_to_treat:
|
|||
filename = match_doc_name.search(hist_line).group()[len(file_dirname):-1]
|
||||
break
|
||||
if result == "OK":
|
||||
mail_content = ok_mail % (error_send_to, u", ".join(send_to), filename, full_name, filename, date, error_send_to)
|
||||
mail_content = ok_mail % (error_send_to, u", ".join(send_to), filename,
|
||||
formatdate(localtime=True),
|
||||
full_name, filename, date, error_send_to)
|
||||
sendMail(error_send_to, send_to, mail_content.encode("utf-8"))
|
||||
else:
|
||||
mail_content = error_mail % (error_send_to, error_send_to, filename, taskID, full_name, user, date, result, u"\n".join(send_to))
|
||||
mail_content = error_mail % (error_send_to, error_send_to,
|
||||
formatdate(localtime=True),
|
||||
filename, taskID, full_name, user, date, result, u"\n".join(send_to))
|
||||
sendMail(error_send_to, error_send_to, mail_content.encode("utf-8"))
|
||||
|
||||
error_file = open(error_filename, "w+")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue