From 16b4e7a8bf455670b6849bd995a7644171b4cd5f Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Wed, 1 Sep 2010 15:12:48 +0200 Subject: [PATCH] =?UTF-8?q?[ldap=5Fcrans]=20Robustesse=20du=20c=C3=A2blage?= =?UTF-8?q?=20automatique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit darcs-hash:20100901131248-ffbb2-2738110e1e430ff40e96bc1de206f3f868035a23.gz --- gestion/ldap_crans.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gestion/ldap_crans.py b/gestion/ldap_crans.py index c29591e9..4546f5c5 100644 --- a/gestion/ldap_crans.py +++ b/gestion/ldap_crans.py @@ -1759,8 +1759,21 @@ class BaseProprietaire(BaseClasseCrans): if r == 'O' or r == 'o': annuaires.crous_to_crans(bat, ch) else: - new_ch = prompt(u"Chambre de l'adhérent ?") - self.chbre(new_ch) + while True: + new_ch = prompt(u"Chambre de l'adhérent ?") + try: + self.chbre(new_ch) + except ValueError, c: + if len(c.args) == 2: + old_adh = c.args[1] + r = prompt(u"Changer %s de chambre ? [O/N]" % old_adh.Nom(), "n") + if r == 'o' or r == 'o': + old_adh.chbre('????') + old_adh.save() + self.chbre(new_ch) + break + else: + break # Enregistrement self._save()