diff --git a/gestion/dialog/adherent.py b/gestion/dialog/adherent.py index 5c9e29a1..0845f049 100644 --- a/gestion/dialog/adherent.py +++ b/gestion/dialog/adherent.py @@ -86,7 +86,7 @@ class Dialog(proprio.Dialog): title="Modification de %s %s" % (adherent['prenom'][0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=choices) def todo(tag, menu, adherent, cont_ret): @@ -142,7 +142,7 @@ class Dialog(proprio.Dialog): title="Gestion administrative de %s %s" % (adherent.get('prenom', [''])[0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(k, menu[k]['text'], menu[k]['help']) for k in menu_order if self.has_right(menu_droits[k], adherent)]) def todo(tag, menu, adherent, self_cont): @@ -348,7 +348,7 @@ class Dialog(proprio.Dialog): title="Connexion de %s %s" % (adherent['prenom'][0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(k, menu[k]['text']) for k in menu_order]) # Génération et crédit de la facture @@ -889,7 +889,7 @@ class Dialog(proprio.Dialog): title="Déménagement de %s %s" % (adherent['prenom'][0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(k, menu[k]['text'], menu[k]['help']) for k in menu_order if self.has_right(menu_droits[k], adherent)]) def todo(tag, menu, adherent, self_cont, cont): @@ -1089,7 +1089,7 @@ class Dialog(proprio.Dialog): title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=choices_etablissement) def box_annee(default_item): @@ -1123,7 +1123,7 @@ class Dialog(proprio.Dialog): title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=box_choice) def box_section(default_item): @@ -1147,7 +1147,7 @@ class Dialog(proprio.Dialog): title="Études de %s %s" % (adherent['prenom'][0], adherent["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=section_ENS) self_cont = TailCall(self.adherent_etudes, adherent=adherent, cont=cont, cancel_cont=cancel_cont, default_item=default_item, etablissement=etablissement, annee=annee, section=section) diff --git a/gestion/dialog/blacklist.py b/gestion/dialog/blacklist.py index 83f75a48..1f785a5d 100644 --- a/gestion/dialog/blacklist.py +++ b/gestion/dialog/blacklist.py @@ -54,7 +54,7 @@ class Dialog(lc.Dialog): scrollbar=True, colors=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=choices) def todo(tag): @@ -93,7 +93,7 @@ class Dialog(lc.Dialog): scrollbar=True, colors=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(k,v) for (k,v) in config.blacklist_items.items()]) def todo(tag, retry_cont): diff --git a/gestion/dialog/certificat.py b/gestion/dialog/certificat.py index bbbd9ce5..a1583415 100644 --- a/gestion/dialog/certificat.py +++ b/gestion/dialog/certificat.py @@ -448,7 +448,7 @@ les valeurs valident sont : title="Modification des certificats de %s" % certificat.machine()['host'][0], scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(key, menu[key]['text'], menu[key]['help']) for key in menu_order if self.has_right(menu_droits[key], certificat)]) def todo(tag, menu, certificat, self_cont): @@ -515,7 +515,7 @@ les valeurs valident sont : scrollbar=True, default_item=str(default_item), cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=choices) def todo(tag): diff --git a/gestion/dialog/lc.py b/gestion/dialog/lc.py index 1b0ab114..faccb6b3 100644 --- a/gestion/dialog/lc.py +++ b/gestion/dialog/lc.py @@ -47,6 +47,12 @@ class Dialog(CPS.Dialog): return True return False + def _connected_as(self): + ret = u"Vous êtes connecté en tant que %s" % self.conn.current_login + if self.ldap_test: + ret += u" sur la base de test" + return ret + def check_ldap(self): """Se connecte à la base ldap et vérifie les droits de l'utilisateur courant""" self.check_ldap_last = time.time() diff --git a/gestion/dialog/machine.py b/gestion/dialog/machine.py index e2df6d61..4285b36b 100644 --- a/gestion/dialog/machine.py +++ b/gestion/dialog/machine.py @@ -225,7 +225,7 @@ class Dialog(certificat.Dialog, blacklist.Dialog): title="Modification de %s" % machine['host'][0], scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(key, menu[key]['text']) for key in menu_order if self.has_right(menu_droits[key], machine)]) def todo(tag, menu, machine, cont_ret): @@ -286,7 +286,7 @@ class Dialog(certificat.Dialog, blacklist.Dialog): title="Création de machines", scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(key, menu[key]['text']) for key in menu_order if self.has_right(menu_droits[key], proprio)]) def todo(tag, menu, proprio, self_cont, cont): diff --git a/gestion/dialog/proprio.py b/gestion/dialog/proprio.py index 7163e8ff..6906c8da 100644 --- a/gestion/dialog/proprio.py +++ b/gestion/dialog/proprio.py @@ -333,7 +333,7 @@ class Dialog(machine.Dialog, blacklist.Dialog): title="Gestion du compte de %s %s" % (proprio.get('prenom', [''])[0], proprio["nom"][0]), scrollbar=True, cancel_label="Retour", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=[(k, menu[k]['text'], menu[k]['help']) for k in menu_order if self.has_right(menu_droits[k], proprio)]) def todo(tag, menu, proprio, self_cont): diff --git a/gestion/gest_crans_lc.py b/gestion/gest_crans_lc.py index d57ba67d..28d3dd51 100755 --- a/gestion/gest_crans_lc.py +++ b/gestion/gest_crans_lc.py @@ -42,7 +42,7 @@ def handle_exit_code(d, code): sys.exit(0) return False else: - return True + return True class GestCrans(adherent.Dialog, club.Dialog, machine.Dialog): @tailcaller @@ -119,6 +119,7 @@ class GestCrans(adherent.Dialog, club.Dialog, machine.Dialog): raise EnvironmentError("Je ne connais que des adherents et des club comme proprio") menu.update(menu_proprio) menu_order = menu_proprio_order + menu_order + def box(default_item=None): choices = [] for key in menu_order: @@ -139,7 +140,7 @@ class GestCrans(adherent.Dialog, club.Dialog, machine.Dialog): scrollbar=True, timeout=self.timeout, cancel_label="Quitter", - backtitle=u"Vous êtes connecté en tant que %s" % self.conn.current_login, + backtitle=self._connected_as(), choices=choices) (code, tag) = self.handle_dialog(TailCall(handle_exit_code, self.dialog, self.dialog.DIALOG_ESC), box, tag)