Commit ddc25a88 authored by Gabriel Detraz's avatar Gabriel Detraz

Passage à lc_ldap et utilisation des variables de config

parent 51ac4b98
......@@ -10,11 +10,15 @@ exempt = [
]
import sys
sys.path.append('/usr/scripts/gestion')
from ldap_crans import crans_ldap, decode
db = crans_ldap()
if not '/usr/scripts' in sys.path:
sys.path.append('/usr/scripts')
import time
from lc_ldap import shortcuts
from lc_ldap import crans_utils
from gestion.config import liste_bats
ldap = shortcuts.lc_ldap_readonly()
bats = 'ABCGHIJMP'
def titre (bat) :
if bat == 'P' :
......@@ -28,20 +32,22 @@ def titre (bat) :
###########################
liste = {}
for bat in bats + '?' :
for bat in liste_bats + ['?'] :
liste[bat] = []
# remplissage de la liste
#########################
adhs = ldap.search(u'(&(finAdhesion>=%(date)s)(aid=*))' % {'date': crans_utils.to_generalized_time_format(time.time())}, sizelimit=4000)
# les extérieurs
adhs = db.search( 'paiement=ok' )['adherent']
for adh in adhs :
bat = adh.chbre()[0]
if not bat in bats :
bat = adh['chbre'][0].value[0].lower()
if not bat in liste_bats :
bat = '?'
if not adh.id() in exempt:
liste[bat].append( u'%s %s' % ( adh.nom(), adh.prenom() ) )
if not adh['aid'][0].value in exempt:
liste[bat].append( u'%s %s' % ( adh['nom'][0].value, adh['prenom'][0].value ) )
# création du fichier tex
#########################
......@@ -57,11 +63,11 @@ print """\\documentclass[a4paper,11pt]{article}
\\begin{document}
\\lhead{A.G.E. du CR@NS}
\\rhead{9 Juillet 2015}
\\rhead{26 Novembre 2015}
\\pagestyle{fancy}
"""
for bat in bats + '?' :
for bat in liste_bats + ['?'] :
# entête du batiment
print """\\section{%(bat)s}\n
\\chead{\emph{%(bat)s}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment