[binding] On gère aussi les dates avec des secondes.

This commit is contained in:
Pierre-Elliott Bécue 2013-11-17 20:26:43 +01:00
parent 3784c10da9
commit db1dc7ec64
2 changed files with 23 additions and 17 deletions

View file

@ -29,6 +29,7 @@ import secrets_new as secrets
import ridtools import ridtools
date_format = '%d/%m/%Y %H:%M' date_format = '%d/%m/%Y %H:%M'
date_format_new = '%d/%m/%Y %H:%M:%S'
hostname = gethostname().split(".")[0] hostname = gethostname().split(".")[0]
smtpserv = "smtp.crans.org" smtpserv = "smtp.crans.org"
random.seed() # On initialise le générateur aléatoire random.seed() # On initialise le générateur aléatoire
@ -2600,7 +2601,11 @@ class Adherent(BaseProprietaire):
if self.historique(): if self.historique():
h = self.historique()[0] h = self.historique()[0]
h = h[:h.find(",")] h = h[:h.find(",")]
return time.mktime(time.strptime(h, date_format)) try:
dateInsc = time.mktime(time.strptime(h, date_format_new))
except:
dateInsc = time.mktime(time.strptime(h, date_format))
return dateInsc
else: else:
# Lors de l'inscription d'un nouvel adhérent, celui-ci n'a pas # Lors de l'inscription d'un nouvel adhérent, celui-ci n'a pas
# encore d'historique. On retourne alors la date en cours. # encore d'historique. On retourne alors la date en cours.

View file

@ -485,7 +485,7 @@ def adher_details(adher) :
# État administratif # État administratif
f += coul("Date d'inscription : ", "gras") f += coul("Date d'inscription : ", "gras")
f += strftime('%d/%m/%Y %H:%M', localtime(adher.dateInscription())) f += strftime('%d/%m/%Y %H:%M:%S', localtime(adher.dateInscription()))
f += coul(u'\nÉtat administratif : ','gras') f += coul(u'\nÉtat administratif : ','gras')
jour=1 jour=1
if ann_scol not in adher.carteEtudiant() : if ann_scol not in adher.carteEtudiant() :
@ -1352,6 +1352,7 @@ if __name__ == '__main__' :
cprint(u"""Une erreur fatale s'est produite durant l'exécution. cprint(u"""Une erreur fatale s'est produite durant l'exécution.
Pour l'amélioration de ce programme merci de prévenir nounou en spécifiant la Pour l'amélioration de ce programme merci de prévenir nounou en spécifiant la
marche à suivre pour reproduire cette erreur.""") marche à suivre pour reproduire cette erreur.""")
raise
if debug : if debug :
cprint('-'*40) cprint('-'*40)
cprint(u'Détails techniques :') cprint(u'Détails techniques :')