fin_connexion: docstrings supp

This commit is contained in:
Daniel STAN 2014-11-30 21:21:04 +01:00
parent c011293227
commit 5501a15cbf

View file

@ -57,6 +57,8 @@ FILTRE_TPL = u"""(&
def warn(mail_conn, adh):
"""Envoie un mail d'avertissement à ``adh``, en utilisant la connexion mail
``mail_conn``"""
fin = min(max(parse_gtf(v.value) for v in adh[l]) \
for l in ['finConnexion', 'finAdhesion'] )
delai = (fin - datetime.datetime.now(pytz.UTC)).days
@ -79,6 +81,7 @@ def warn(mail_conn, adh):
def compute_fin_connexion(adh):
"""Renvoie le datetime de fin effective de connexion de l'``adh``"""
return min( max(parse_gtf(v.value) for v in adh['fin' + l])
for l in ['Adhesion', 'Connexion'])
@ -101,6 +104,8 @@ def select(conn, begin, to, mode='r'):
return res
def brief(c, debut, fin):
"""Renvoie la liste des adhérents dont la connexion expire entre
debut et fin"""
if not debut.tzinfo:
debut = debut.replace(tzinfo=pytz.UTC)
if not fin.tzinfo:
@ -129,7 +134,7 @@ def prev_calendar(c, date):
last = first.replace(month=1+month%12, year=year+int(month==12))
disconnect = select(c, first, last)
by_day = {x: 0 for x in xrange(1,32)}
by_day = {x: 0 for x in xrange(1, 32)}
for adh in disconnect:
date = compute_fin_connexion(adh)
by_day[date.day] += 1