38 lines
820 B
Python
Executable file
38 lines
820 B
Python
Executable file
#! /usr/bin/env python
|
|
# -*- coding: iso8859-15 -*-
|
|
|
|
"""
|
|
Ce script sert à donner l'occupation des switchs du batiment G
|
|
Il affiche 3 colonnes :
|
|
- la prise
|
|
- la chambre
|
|
- si il y a qqun dans la chambre
|
|
"""
|
|
|
|
import sys
|
|
|
|
sys.path.append('/usr/scripts/gestion')
|
|
from annuaires import reverse
|
|
from ldap_crans import crans_ldap
|
|
from affich_tools import tableau
|
|
db = crans_ldap()
|
|
|
|
# dictionnaire revers du bat
|
|
dico = reverse('g')
|
|
|
|
# toutes les prises
|
|
prises = dico.keys()
|
|
prises.sort()
|
|
|
|
# chambres occupées
|
|
chbres = [ a.chbre() for a in db.search('chbre=G*&paiement=ok')['adherent'] ]
|
|
|
|
data= []
|
|
|
|
for p in prises:
|
|
if [ chbre for chbre in dico[p] if 'G%s'%chbre in chbres ]:
|
|
data.append( [ p, ','.join(dico[p]), 'O'] )
|
|
else:
|
|
data.append( [ p, ','.join(dico[p]), 'N'] )
|
|
|
|
print tableau(data)
|