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:
parent
c636fcca6d
commit
524e8ee000
4 changed files with 19 additions and 19 deletions
|
@ -15,7 +15,7 @@ import lc_ldap.shortcuts
|
|||
from lc_ldap.crans_utils import escape as escape_ldap
|
||||
import lc_ldap.crans_utils
|
||||
import lc_ldap.objets
|
||||
from gestion.config.config import vlans
|
||||
import gestion.config.config as config
|
||||
from gestion.gen_confs.trigger import trigger_generate_cochon as trigger_generate
|
||||
import annuaires_pg
|
||||
|
||||
|
@ -287,7 +287,7 @@ def post_auth_wifi(data):
|
|||
radiusd.radlog(radiusd.L_AUTH, log_message)
|
||||
|
||||
# Si NAS ayant des mapping particuliers, à signaler ici
|
||||
vlan_id = vlans[vlan_name]
|
||||
vlan_id = config.vlans[vlan_name]
|
||||
|
||||
# WiFi : Pour l'instant, on ne met pas d'infos de vlans dans la réponse
|
||||
# les bornes wifi ont du mal avec cela
|
||||
|
@ -317,7 +317,7 @@ def post_auth_fil(data):
|
|||
radiusd.radlog(radiusd.L_AUTH, log_message)
|
||||
|
||||
# Si NAS ayant des mapping particuliers, à signaler ici
|
||||
vlan_id = vlans[vlan_name]
|
||||
vlan_id = config.vlans[vlan_name]
|
||||
|
||||
# Filaire
|
||||
return (radiusd.RLM_MODULE_UPDATED,
|
||||
|
|
|
@ -36,7 +36,7 @@ import config
|
|||
import config.cotisation as cotisation
|
||||
from affich_tools import cprint, to_encoding, to_unicode
|
||||
from lock import make_lock, remove_lock
|
||||
from ldap_crans import crans_ldap, blacklist_items, ann_scol, droits_possibles, droits_critiques, smtpserv, script_utilisateur
|
||||
from ldap_crans import crans_ldap, blacklist_items, droits_possibles, droits_critiques, smtpserv, script_utilisateur
|
||||
from ldap_crans import Adherent, AssociationCrans, Club, Facture
|
||||
from ldap_crans import Machine, MachineFixe, MachineWifi, MachineCrans, BorneWifi
|
||||
from ldap_crans import tz, generalizedTimeFormat, fromGeneralizedTimeFormat
|
||||
|
|
|
@ -764,13 +764,13 @@ class CransLdap:
|
|||
# définifif (cf config.py).
|
||||
if config.periode_transitoire:
|
||||
# Pour la période transitoire année précédente ok
|
||||
el = "(|(paiement=%d)(paiement=%d)(finAdhesion>=%s))" % (ann_scol, ann_scol-1, generalizedTimeFormat(time.time()))
|
||||
el = "(|(paiement=%d)(paiement=%d)(finAdhesion>=%s))" % (config.ann_scol, config.ann_scol-1, generalizedTimeFormat(time.time()))
|
||||
else:
|
||||
el = "(|(paiement=%s)(finAdhesion>=%s))" % (ann_scol, generalizedTimeFormat(time.time()))
|
||||
el = "(|(paiement=%s)(finAdhesion>=%s))" % (config.ann_scol, generalizedTimeFormat(time.time()))
|
||||
# Doit-on bloquer en cas de manque de la carte d'etudiant ?
|
||||
# (si période transitoire on ne bloque dans aucun cas)
|
||||
if config.bl_carte_et_definitif:
|
||||
el = "(&(|(carteEtudiant=%d)(objectClass=club)(carteEtudiant=TRUE))%s)" % (ann_scol, el)
|
||||
el = "(&(|(carteEtudiant=%d)(objectClass=club)(carteEtudiant=TRUE))%s)" % (config.ann_scol, el)
|
||||
elif champ[1:] == 'blacklist':
|
||||
el = '(blacklist=%s)' % expr
|
||||
else:
|
||||
|
@ -2796,7 +2796,7 @@ class Club(BaseProprietaire):
|
|||
return strip_accents(self.Nom())
|
||||
|
||||
def carteEtudiant(self, pd=None):
|
||||
return [ ann_scol ]
|
||||
return [ config.ann_scol ]
|
||||
|
||||
def responsable(self, adher=None):
|
||||
""" Responsable du club, adher doit être une instance de la classe adhérent """
|
||||
|
@ -4243,9 +4243,9 @@ class _FakeProprio(CransLdap):
|
|||
raise ValueError("Impossible de blacklister %r" % str(self))
|
||||
return []
|
||||
def paiement(self):
|
||||
return [ ann_scol ]
|
||||
return [ config.ann_scol ]
|
||||
def carteEtudiant(self):
|
||||
return [ ann_scol ]
|
||||
return [ config.ann_scol ]
|
||||
def blacklist_actif(self):
|
||||
return []
|
||||
def mail(self, new=None):
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue