[dialogwizard,gest_crans2] on utilise True et Flase pour cocher
Ignore-this: c1a8930338b851e26506652dd09db5d8 darcs-hash:20090916190224-bd074-087e2f6b311e24d212376f10e3fa45a6d151ab01.gz
This commit is contained in:
parent
42b74ec0e3
commit
a62d0a2257
3 changed files with 37 additions and 26 deletions
|
@ -40,12 +40,13 @@ import os, sys#, string
|
|||
# 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,
|
||||
#from ldap_crans import crans_ldap, script_utilisateur#, blacklist_items, ann_scol, droits_possibles, droits_critiques, smtpserv,
|
||||
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 Adherent #, AssociationCrans, Club
|
||||
# from ldap_crans import Machine, MachineFixe, MachineWifi, MachineCrans, BorneWifi
|
||||
# import user_tests
|
||||
|
||||
|
@ -201,17 +202,23 @@ def prompt_etudes(name):
|
|||
|
||||
return etudes_scenar
|
||||
|
||||
# prompt_connexion = \
|
||||
# dsgen.form_step (u"Type de connexion",
|
||||
# u'Inscription adhérent',
|
||||
# 'typ', [('1', 'Adhésion'),
|
||||
# ('2', 'Inscription gratuite')])
|
||||
prompt_connexion = \
|
||||
dsgen.select_step (u"Type de connexion",
|
||||
u'Inscription adhérent',
|
||||
'typ', [('1', 'Adhésion'),
|
||||
('2', 'Inscription gratuite')])
|
||||
|
||||
prompt_papiers = \
|
||||
dsgen.checklist_step('', u'État administratif de %(nom)s',
|
||||
[('carte', u"Carte d'étudiant %s-%s fourniee" % (ann_scol, ann_scol+1)),
|
||||
('paiement%s' % ann_scol, u'Cotisation %s réglée et charte signée' % ann_scol),
|
||||
('chartema', u'Charte des membres actifs signée')])
|
||||
{'var': 'chartema', 'item': u'Charte des membres actifs signée',
|
||||
'show_cond': (lambda d: isbureau or isadm)},
|
||||
{'var': '+p', 'item': u'Paiement et charte vérifiées',
|
||||
'show_cond': (lambda d: iscontroleur)},
|
||||
{'var': '+c', 'item': u"Carte d'étudiant vérifiée",
|
||||
'show_cond': (lambda d: iscontroleur)}
|
||||
])
|
||||
|
||||
prompt_login = \
|
||||
dsgen.input_step(u'Choix du login pour %(nom)s',
|
||||
|
@ -226,16 +233,16 @@ dummy_scenar.nest(prompt_new_adher)
|
|||
dummy_scenar.nest(prompt_addr_ext)
|
||||
dummy_scenar.quote(prompt_etudes('toto'))
|
||||
|
||||
Running(dummy_scenar).run()
|
||||
print Running(dummy_scenar).run()
|
||||
|
||||
def inscrit_in_ldap(adherent):
|
||||
"""Prend en argument un dictionnaire, et l'inscrit dans la base ldap
|
||||
|
||||
Les champs suivants ont OBLIGATOIRES:
|
||||
nom, prenom, chbre, mail, login
|
||||
|
||||
Les champs suivants sont OPTIONNELS:
|
||||
carte, paiementYEAR, tel, etud1, etud2, etud3, addr1, addr2, addr3, addr4
|
||||
"""
|
||||
|
||||
adher = Adherent()
|
||||
# def inscrit_in_ldap(adherent):
|
||||
# """Prend en argument un dictionnaire, et l'inscrit dans la base ldap
|
||||
#
|
||||
# Les champs suivants ont OBLIGATOIRES:
|
||||
# nom, prenom, chbre, mail, login
|
||||
#
|
||||
# Les champs suivants sont OPTIONNELS:
|
||||
# carte, paiementYEAR, tel, etud1, etud2, etud3, addr1, addr2, addr3, addr4
|
||||
# """
|
||||
#
|
||||
# adher = Adherent()
|
||||
|
|
|
@ -70,16 +70,20 @@ class DialogStepGenerator():
|
|||
sliste = []
|
||||
for c in liste:
|
||||
try:
|
||||
sliste.append((c[0], c[1], dico.get(c[0], 'off')))
|
||||
if dico.get(c[0], False): checked = 'on'
|
||||
else: checked = 'off'
|
||||
sliste.append((c[0], c[1], checked))
|
||||
except Exception,e:
|
||||
if c.get('show_cond', lambda x : True)(dico):
|
||||
sliste.append((c['var'], c['item'], dico.get(c['var'], 'off')))
|
||||
if dico.get(c['var'], False): checked = 'on'
|
||||
else: checked = 'off'
|
||||
sliste.append((c['var'], c['item'], checked))
|
||||
rc, res = self.d.checklist(enonce, title = title, choices = sliste, **kw)
|
||||
self._check_rc(rc)
|
||||
for tag, item, status in liste:
|
||||
if tag in res:
|
||||
dico[tag] = 'on'
|
||||
dico[tag] = True
|
||||
else:
|
||||
dico[tag] = 'off'
|
||||
dico[tag] = False
|
||||
return dico
|
||||
return Step(fn)
|
||||
|
|
|
@ -90,15 +90,15 @@ def unit_scenario():
|
|||
class Running:
|
||||
u"""To run scenarios"""
|
||||
|
||||
env = {}
|
||||
defaults = {}
|
||||
steps = None
|
||||
stack = None
|
||||
|
||||
def __init__(self, scenario):
|
||||
def __init__(self, scenario, env = {}):
|
||||
if not isinstance(scenario, Scenario):
|
||||
raise TypeError("Can only run Scenarios")
|
||||
accu = scenario.steps
|
||||
self.env = env
|
||||
|
||||
# To avoid brain spots on the walls, we shall reverse the list
|
||||
# of steps.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue