[print_status.py] notif pour les jobs via wrapper
Il reste un bug de notification pour le club Crans: la liste des imprimeurs de ce club semble vide. En attendant, le cron va envoyer des mails si ça arrive.
This commit is contained in:
parent
ebe94de094
commit
2ca9b45851
3 changed files with 14 additions and 4 deletions
|
@ -136,9 +136,13 @@ tasks_to_treat.reverse()
|
|||
|
||||
for item in tasks_to_treat:
|
||||
fields = item.split(',', 6)
|
||||
if fields[3].strip('"') == "root":
|
||||
if fields[3].strip('"') in ["root",'DIRECT PRINT']:
|
||||
result = fields[1].strip('"')
|
||||
taskID, user, _ = fields[2].strip('"').split(':',2)
|
||||
jobinfos = fields[2].strip('"').split(':', 2)
|
||||
if len(jobinfos) <= 2:
|
||||
print "Skipping: %s" % fields[2]
|
||||
continue
|
||||
taskID, user, _ = jobinfos
|
||||
user = user.split('@').pop() # On récupère le nom du club si besoin.
|
||||
date = buildDate(fields[5])
|
||||
match_taskID = re.compile(r"impression\(%s\)" % taskID)
|
||||
|
@ -155,6 +159,9 @@ for item in tasks_to_treat:
|
|||
target = db_query['club'][0]
|
||||
full_name = u"Club " + target.nom()
|
||||
send_to = map(lambda aid : db.search("aid=" + aid)['adherent'][0].mail(), target.imprimeurs())
|
||||
if send_to == []:
|
||||
print "Skipping sending to %s, empty recipient" % full_name
|
||||
continue
|
||||
historique = target.historique()
|
||||
historique.reverse() # Ce qu'on cherche a des chances d'être récent et donc d'être à la fin de l'historique.
|
||||
file_dirname = files_directory + user + r"/"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue