diff --git a/gestion/whos.py b/gestion/whos.py index 7ae92bcc..9b479d8a 100755 --- a/gestion/whos.py +++ b/gestion/whos.py @@ -750,7 +750,7 @@ def prise_etat(chbre) : f+= u', activée, lien non détecté' except ConversationError: # Switch non manageable ou down - f = u'info prise non dispo : erreur de communication' + f += u', erreur de communication avec le switch' except : f = u'info prise non dispo : erreur prog' @@ -875,25 +875,26 @@ def __recherche() : if arg.count('=') == 1 and arg.split('=')[0] == 'prise' : prise = arg.split('=')[1] # Récupération de la chambre - try : + try: from annuaires import reverse chbre = reverse(prise[0].lower())[prise[1:]] - except : - try : + except KeyError: + try: chbre = reverse(prise[0].lower())[prise[1:]+'-'] - except : - print u"Prise inconnue." + except KeyError: + chbre=None + + if chbre: + if len(chbre) != 1 : + print u"Prise correspondante à plusieurs chambres %s " % ' '.join(chbre) return - if len(chbre) != 1 : - print u"Prise correspondante à plusieurs prises %s " % ' '.join(chbre) - return - - # On fait la recherche sur la prise - chbre= prise[0] + chbre[0] - #print u"Recherche sur chambre %s" % chbre - arg = 'chbre=%s' % chbre - - try : + # On fait la recherche sur la chambre + chbre= prise[0] + chbre[0] + #print u"Recherche sur chambre %s" % chbre + arg = 'chbre=%s' % chbre + # sinon on ne fait rien et on recherche sur le champ prise + + try: if only_crans : res = { 'machine' : crans().machines() , 'adherent' : [] , 'club' : [] } else :