Retabification de quelques lignes pour avoir le msg d'erreur quand la
chambre est invalide + modifs mineures. darcs-hash:20051021132849-41617-488f4d733a089e325a2f2a4cd7941df8fa830a9f.gz
This commit is contained in:
parent
6171d04d89
commit
a2536fcab6
1 changed files with 26 additions and 27 deletions
|
@ -96,22 +96,23 @@ def _set_chbre(adher,chbre) :
|
|||
# Réservé à un usage interne
|
||||
return u'Chambre invalide\n'
|
||||
|
||||
try : c = adher.chbre(chbre)
|
||||
try: c = adher.chbre(chbre)
|
||||
except EnvironmentError, c : return c.args[0] + '\n'
|
||||
except ValueError, c :
|
||||
try :
|
||||
if len(c.args)==2 :
|
||||
# La chambre est occup-Aée-b
|
||||
squatteur = c.args[1]
|
||||
aff(squatteur)
|
||||
arg = u'--title "Inscription adhérent" '
|
||||
arg+= u'--yesno "Un adhérent (%s) occupe déjà cette chambre.\n' % squatteur.Nom()
|
||||
arg+= u'\nChanger la chambre de cet adhérent ?" 0 0'
|
||||
no, res = dialog(arg)
|
||||
if no : raise # On laisse l'erreur
|
||||
squatteur.chbre('????')
|
||||
squatteur.save()
|
||||
return _set_chbre(adher,chbre) # On recommence, le géneur doit être parti.
|
||||
except :
|
||||
return c.args[0] + '\n'
|
||||
if not no :
|
||||
squatteur.chbre('????')
|
||||
squatteur.save()
|
||||
# On recommence, le géneur doit être parti.
|
||||
return _set_chbre(adher,chbre)
|
||||
return c.args[0] + '\n'
|
||||
|
||||
return u''
|
||||
|
||||
|
@ -1252,18 +1253,18 @@ def modif_adher(adher) :
|
|||
arg+= u'"3" "Départ du campus en conservant son compte ?" '
|
||||
arg+= u'"4" "Départ du campus en supprimant son compte ?" '
|
||||
annul , result = dialog(arg)
|
||||
if annul : return 1
|
||||
if annul : return modif_adher(adher)
|
||||
if result[0]=='2' :
|
||||
if set_addr_ext(adher) :
|
||||
# Annulation
|
||||
return 1
|
||||
return modif_adher(adher)
|
||||
adher.chbre('EXT')
|
||||
elif result[0]=='3' :
|
||||
arg = u'--title "Départ de %s" ' % adher.Nom()
|
||||
arg+= u'--yesno "Le départ d\'un adhérent provoque la destruction de ses machines.\n'
|
||||
arg+= u'\nDoit-on continuer ?" 0 0'
|
||||
no, res = dialog(arg)
|
||||
if no: return 1
|
||||
if no: return modif_adher(adher)
|
||||
for m in adher.machines():
|
||||
m.delete("Depart du campus")
|
||||
adher.chbre('EXT')
|
||||
|
@ -1272,12 +1273,12 @@ def modif_adher(adher) :
|
|||
arg = u'--title "Destruction adherent" '
|
||||
arg+= u'--msgbox "Vous n\'avez pas les droits necessaires pour effectuer cette opération.\n\n\n" 0 0'
|
||||
dialog(arg)
|
||||
return 1
|
||||
return modif_adher(adher)
|
||||
arg = u'--title "Départ de %s" ' % adher.Nom()
|
||||
arg+= u'--yesno "Le départ du campus de %s va provoquer la destruction de son compte.\n' % adher.Nom()
|
||||
arg+= u'\nDoit-on continuer ?" 0 0'
|
||||
no, res = dialog(arg)
|
||||
if no: return 1
|
||||
if no: return modif_adher(adher)
|
||||
for m in adher.machines():
|
||||
m.delete("Depart du campus")
|
||||
adher.delete("Depart du campus")
|
||||
|
@ -1288,30 +1289,28 @@ def modif_adher(adher) :
|
|||
arg = u'--title "Déménagement de %s" ' % adher.Nom()
|
||||
arg+= u'--inputbox "Chambre ?" 0 0 '
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
if annul : return modif_adher(adher)
|
||||
|
||||
e=0
|
||||
try :
|
||||
e = _set_chbre(adher, res[0])
|
||||
if res[0] =='EXT' :
|
||||
# Il faut demander l'adresse extérieure
|
||||
if set_addr_ext(adher) :
|
||||
# Annulation
|
||||
continue
|
||||
break
|
||||
except EnvironmentError, c : e = c.args[0]
|
||||
except ValueError, c : e = c.args[0]
|
||||
e = _set_chbre(adher, res[0])
|
||||
if res[0] =='EXT' :
|
||||
# Il faut demander l'adresse extérieure
|
||||
if set_addr_ext(adher) :
|
||||
# Annulation
|
||||
continue
|
||||
if e :
|
||||
arg = u'--title "Déménagement de %s" ' % adher.Nom()
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % e
|
||||
dialog(arg)
|
||||
else :
|
||||
break
|
||||
|
||||
|
||||
elif res[0]=='Téléphone' :
|
||||
while 1 :
|
||||
arg = u'--title "Changement numéro de téléphone de de %s" ' % adher.Nom()
|
||||
arg+= u'--inputbox "Nouveau numéro ?" 0 0 "%s" ' % adher.tel()
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
if annul : return modif_adher(adher)
|
||||
|
||||
try :
|
||||
adher.tel(res[0].replace(' ',''))
|
||||
|
@ -1329,7 +1328,7 @@ def modif_adher(adher) :
|
|||
arg = u'--title "Nouveau shell pour %s" ' % adher.Nom()
|
||||
arg+= u'--inputbox "Shell : " 0 0 "%s" ' % adher.chsh()
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
if annul : return modif_adher(adher)
|
||||
|
||||
try :
|
||||
adher.chsh(res[0])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue