Passage aux adhésions glissantes (partie I, sans lc_ldap)
This commit is contained in:
parent
169b7000b8
commit
49cef4c095
12 changed files with 485 additions and 231 deletions
|
@ -16,7 +16,11 @@ ACTIONS POSSIBLES
|
|||
# Licence : GPLv2
|
||||
|
||||
|
||||
import sys, os, re, time, cPickle
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import cPickle
|
||||
from time import mktime, time, localtime, strptime, strftime
|
||||
from socket import gethostname
|
||||
from smtplib import SMTP
|
||||
|
@ -187,7 +191,7 @@ Légende :
|
|||
- F : existence d'un .forward
|
||||
- M : existence de mails non lus
|
||||
|
||||
--
|
||||
--
|
||||
comptes_inactifs.py
|
||||
"""
|
||||
inscrits = []
|
||||
|
@ -208,7 +212,7 @@ comptes_inactifs.py
|
|||
mail = nb_mails_non_lus(login)
|
||||
mail = mail == None and u'?' or mail > 0 and u'X' or u' '
|
||||
ligne = (a.id(), login, a.Nom(), date, forward, mail)
|
||||
if ann_scol in a.paiement():
|
||||
if ann_scol in a.paiement() or a.adhesion() > time():
|
||||
inscrits.append(ligne)
|
||||
else:
|
||||
anciens.append(ligne)
|
||||
|
@ -292,7 +296,7 @@ comptes_inactifs.py
|
|||
recapitulatif += u"""
|
||||
Total : %d
|
||||
|
||||
--
|
||||
--
|
||||
comptes_inactifs.py
|
||||
""" % total
|
||||
send_email(mail_sender,
|
||||
|
|
|
@ -69,11 +69,11 @@ def generate_ps(sanction, proprio, db):
|
|||
log('Generate deconnexion notice for %s' % proprio.Nom())
|
||||
# Dossier de génération du ps
|
||||
dossier = '/usr/scripts/surveillance/fiche_deconnexion'
|
||||
|
||||
|
||||
# Base pour le nom du fichier
|
||||
fichier = time.strftime('%Y-%m-%d-%H-%M') + '-%s-%s' % (sanction,
|
||||
strip_accents(proprio.Nom().lower().replace(' ', '-')))
|
||||
|
||||
|
||||
# Création du fichier tex
|
||||
format_date = '%A %d %B %Y'
|
||||
template = file('%s/deconnexion_%s.tex' % (dossier, sanction)).read()
|
||||
|
@ -103,9 +103,9 @@ def generate_ps(sanction, proprio, db):
|
|||
if sanction == 'upload' :
|
||||
template = template.replace('~limitehard~', str(upload.hard))
|
||||
template = template.replace('~nbadher~', str(len(db.search('paiement=ok')['adherent'])))
|
||||
|
||||
|
||||
file('%s/%s.tex' % (dossier, fichier), 'w').write(template)
|
||||
|
||||
|
||||
# Compilation du fichier latex
|
||||
# Paquets nécessaires : texlive-latex-base, texlive-latex-recommended,
|
||||
# texlive-latex-extra, texlive-lang-french, texlive-luatex,
|
||||
|
@ -123,18 +123,18 @@ def generate_ps(sanction, proprio, db):
|
|||
strip_accents(proprio.Nom())))
|
||||
log(exceptions.formatExc())
|
||||
raise e
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def log(x):
|
||||
print x
|
||||
|
||||
|
||||
def aide():
|
||||
print help
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if '--help' in sys.argv or '-h' in sys.argv:
|
||||
aide()
|
||||
|
||||
|
||||
db = crans_ldap()
|
||||
|
||||
sanction = ''
|
||||
|
@ -145,7 +145,7 @@ if __name__ == "__main__":
|
|||
if not sanction :
|
||||
print "Erreur : aucune sanction définie.\n"
|
||||
aide()
|
||||
|
||||
|
||||
if len(sys.argv) <= 2 :
|
||||
print "Erreur : aucun motif de recherche défini.\n"
|
||||
aide()
|
||||
|
@ -162,7 +162,7 @@ if __name__ == "__main__":
|
|||
aide()
|
||||
else :
|
||||
adherent = recherche[0]
|
||||
|
||||
|
||||
# On génére alors le postscript
|
||||
fichier = generate_ps(sanction, adherent, db)
|
||||
print u'Le fichier %s a été généré.' % fichier
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue