from config import $X -> import config; config.$X

Comme ça, on pourra envisager de reload un module de config après un certain
temps.
This commit is contained in:
Daniel STAN 2014-11-18 13:32:33 +01:00
parent c636fcca6d
commit 524e8ee000
4 changed files with 19 additions and 19 deletions

View file

@ -55,11 +55,11 @@ except:
base = None
from time import strftime, localtime, time
from ldap_crans import is_actif, crans_ldap, ann_scol, AssociationCrans, hostname
from ldap_crans import is_actif, crans_ldap, AssociationCrans, hostname
from ldap_crans import MachineCrans, MachineWifi, BorneWifi
from ldap_crans import Adherent
from affich_tools import *
from config import rid, periode_transitoire, debut_periode_transitoire, fin_periode_transitoire
import gestion.config as config
import user_tests
import subprocess, commands
import ridtools
@ -582,7 +582,7 @@ def adher_details(adher) :
if not adher.carteEtudiant() :
f += coul(u"manque carte d'étudiant",'violet')
jour = False
if ann_scol not in adher.paiement() and (adher.adhesion() <= time()):
if config.ann_scol not in adher.paiement() and (adher.adhesion() <= time()):
if not jour: f += ' et '
f += coul(u"non adhérent actuellement",'violet')
jour = False
@ -655,11 +655,11 @@ def adher_details(adher) :
if adher.adhesion() > time():
f += coul(u"Adhésion jusqu'au %s" % strftime("%d/%m/%Y %H:%M:%S", localtime(adher.adhesion())), "vert")
f += u"\n"
elif ann_scol in adher.paiement():
f += coul(u"Paiement pour %s/%s ok (connexion incluse)" % (ann_scol, ann_scol+1), "vert")
elif config.ann_scol in adher.paiement():
f += coul(u"Paiement pour %s/%s ok (connexion incluse)" % (config.ann_scol, config.ann_scol+1), "vert")
f += u"\n"
elif periode_transitoire and ((ann_scol - 1) in adher.paiement() or debut_periode_transitoire <= min(adher.adhesion(), adher.connexion()) <= fin_periode_transitoire):
f += coul(u"Fin d'adhésion, mais en sursis jusqu'au %s" % (strftime("%d/%m/%Y %H:%M:%S", localtime(fin_periode_transitoire)),), "rouge")
elif config.periode_transitoire and ((config.ann_scol - 1) in adher.paiement() or config.debut_periode_transitoire <= min(adher.adhesion(), adher.connexion()) <= config.fin_periode_transitoire):
f += coul(u"Fin d'adhésion, mais en sursis jusqu'au %s" % (strftime("%d/%m/%Y %H:%M:%S", localtime(config.fin_periode_transitoire)),), "rouge")
f += u"\n"
# Paiement
@ -929,7 +929,7 @@ def club_details(club) :
# État administratif
f += coul(u'État administratif : ','gras')
jour = True
if club.adhesion() < time() and ann_scol not in club.paiement():
if club.adhesion() < time() and config.ann_scol not in club.paiement():
jour = False
f += coul(u"Non adhérent." ,'violet')
@ -954,7 +954,7 @@ def club_details(club) :
if club.adhesion() > time():
f += coul(u"Adhésion jusque %s (connexion incluse)." % (strftime("%d/%m/%Y %H:%M:%S", localtime(club.adhesion())),), "vert")
f += '\n'
elif ann_scol in club.paiement():
elif config.ann_scol in club.paiement():
f += coul(u"Adhésion pour l'année en cours", "vert")
f += '\n'