auth.py: fix crash si chambre Inconnue
This commit is contained in:
parent
11a5c70b56
commit
673b775ef4
1 changed files with 6 additions and 3 deletions
|
@ -339,10 +339,13 @@ def decide_vlan(data, is_wifi, conn):
|
||||||
else:
|
else:
|
||||||
decision = 'adherent', u''
|
decision = 'adherent', u''
|
||||||
prise, chbre = get_prise_chbre(data)
|
prise, chbre = get_prise_chbre(data)
|
||||||
port = "%s/%s" % (prise, chbre)
|
port = "%s/%s" % (prise, chbre or 'Inconnue')
|
||||||
|
|
||||||
chbre = escape_ldap(chbre)
|
if chbre:
|
||||||
hebergeurs = conn.search(u'(&(chbre=%s)(|(cid=*)(aid=*)))' % chbre)
|
chbre = escape_ldap(chbre)
|
||||||
|
hebergeurs = conn.search(u'(&(chbre=%s)(|(cid=*)(aid=*)))' % chbre)
|
||||||
|
else:
|
||||||
|
hebergeurs = []
|
||||||
|
|
||||||
# Prend la première machine candidat dans la base, ou exit
|
# Prend la première machine candidat dans la base, ou exit
|
||||||
items = get_machines(data, is_wifi=is_wifi, proprio=(hebergeurs+[None])[0])
|
items = get_machines(data, is_wifi=is_wifi, proprio=(hebergeurs+[None])[0])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue