[gest_crans2.py] test avec cransldap
Ignore-this: da8719f4b6a57eed9b51c0d11d838f33 darcs-hash:20090929132216-bd074-296ac4861c39e909044f72fc3cbb2a933387a2e5.gz
This commit is contained in:
parent
277b1c4bd5
commit
eac68563c9
1 changed files with 15 additions and 26 deletions
|
@ -32,30 +32,19 @@ To = ['fred@crans.org', 'glondu@crans.org', 'dimino@crans.org',
|
|||
'salles@crans.org', 'cohen@crans.org', 'segaud@crans.org',
|
||||
'adg@crans.org']
|
||||
|
||||
import os, sys#, string
|
||||
# import dialog
|
||||
# from whos import aff
|
||||
# import signal, getopt
|
||||
# from time import strftime, strptime, localtime, mktime
|
||||
# import re
|
||||
#
|
||||
# import affich_tools, config
|
||||
from config import ann_scol
|
||||
# from lock import make_lock, remove_lock
|
||||
#from ldap_crans import crans_ldap, script_utilisateur#, blacklist_items, ann_scol, droits_possibles, droits_critiques, smtpserv,
|
||||
import os, sys
|
||||
sys.path.append('/usr/scripts')
|
||||
from lib.dialogwizard.wizard import Scenario, Running, step_scenario, unit_scenario
|
||||
from lib.dialogwizard.dialogwizard import DialogStepGenerator
|
||||
#from ldap_crans import Adherent #, AssociationCrans, Club
|
||||
# from ldap_crans import Machine, MachineFixe, MachineWifi, MachineCrans, BorneWifi
|
||||
# import user_tests
|
||||
|
||||
# isadm = user_tests.isadm()
|
||||
# isdeconnecteur = user_tests.isdeconnecteur()
|
||||
from ldap_crans import crans_ldap, script_utilisateur
|
||||
import user_tests
|
||||
from config import ann_scol
|
||||
from crans.dialogwizard.wizard import Scenario, Running, step_scenario, unit_scenario
|
||||
from crans.dialogwizard.dialogwizard import DialogStepGenerator, error_handler
|
||||
|
||||
#db = crans_ldap()
|
||||
#droits = db.search("uid=%s" % script_utilisateur)['adherent'][0].droits()
|
||||
droits = []
|
||||
db = crans_ldap()
|
||||
droits = db.search("uid=%s" % script_utilisateur)['adherent'][0].droits()
|
||||
isadm = user_tests.isadm()
|
||||
isdeconnecteur = user_tests.isdeconnecteur()
|
||||
isimprimeur = u"Imprimeur" in droits
|
||||
iscontroleur = u'Tresorier' in droits
|
||||
isbureau = u'Bureau' in droits
|
||||
|
@ -75,7 +64,7 @@ prompt_new_adher = \
|
|||
[{'var': 'nom', 'label': 'Nom :', 'field_len': 20},
|
||||
{'var': 'prenom', 'label': u'Prénom :', 'field_len': 20},
|
||||
{'var': 'tel', 'label': u'Numéro de téléphone', 'field_len': 13},
|
||||
{'var': 'chbre', 'label': u'Chambre :', 'field_len': 5} ])
|
||||
{'var': 'chbre', 'label': u'Chambre (EXT si pas sur le campus) :', 'field_len': 5} ])
|
||||
|
||||
prompt_addr_ext = \
|
||||
dsgen.form_step (u"Adresse extérieure de %(nom)s", '',
|
||||
|
@ -84,7 +73,7 @@ prompt_addr_ext = \
|
|||
{'var': 'addr3', 'label': 'Code Postal :', 'field_len': 6},
|
||||
{'var': 'addr4', 'label': 'Ville :', 'field_len': 20}])
|
||||
|
||||
def prompt_etudes(name):
|
||||
def prompt_etudes():
|
||||
etab_step = \
|
||||
dsgen.select_step(u'Études de %(nom)s (1/3)',
|
||||
u"Choisissez l'établissement :",
|
||||
|
@ -185,7 +174,7 @@ def prompt_etudes(name):
|
|||
|
||||
ens_scenar = Scenario()
|
||||
ens_scenar.nest(year_ens_step)
|
||||
ens_scenar.branch((lambda d: d['etud2'] in ['1','2','3','4']),
|
||||
ens_scenar.branch((lambda d: d['etud2'] in ['1', '2', '3', '4']),
|
||||
step_scenario(section_step),
|
||||
step_scenario(labo_step))
|
||||
|
||||
|
@ -231,9 +220,9 @@ prompt_mailaddress = \
|
|||
dummy_scenar = Scenario()
|
||||
dummy_scenar.nest(prompt_new_adher)
|
||||
dummy_scenar.nest(prompt_addr_ext)
|
||||
dummy_scenar.quote(prompt_etudes('toto'))
|
||||
dummy_scenar.quote(prompt_etudes())
|
||||
|
||||
print Running(dummy_scenar).run()
|
||||
print Running(dummy_scenar, env= db.search('nom=durand-gasselin')['adherent'][0], handle = error_handler).run()
|
||||
|
||||
# def inscrit_in_ldap(adherent):
|
||||
# """Prend en argument un dictionnaire, et l'inscrit dans la base ldap
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue