From 0aed975615f9f5869223742f2c11287b13a02129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Mon, 20 Mar 2017 08:14:20 +0000 Subject: [PATCH] Fix the empty-query test in autocomplete If there is no valid word to search in the LDAP database, no query is performed. Since 74f0b63e, that behaviour was broken because of a typo --- gestioncof/autocomplete.py | 2 +- kfet/autocomplete.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gestioncof/autocomplete.py b/gestioncof/autocomplete.py index 1146e1c0..a9abbad7 100644 --- a/gestioncof/autocomplete.py +++ b/gestioncof/autocomplete.py @@ -60,7 +60,7 @@ def autocomplete(request): '(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=bit) for bit in bits if bit.isalnum() )) - if ldap_query != "(|)": + if ldap_query != "(&)": # If none of the bits were legal, we do not perform the query with Connection(settings.LDAP_SERVER_URL) as conn: conn.search( diff --git a/kfet/autocomplete.py b/kfet/autocomplete.py index 2dd3c32f..c0019bf9 100644 --- a/kfet/autocomplete.py +++ b/kfet/autocomplete.py @@ -79,7 +79,7 @@ def account_create(request): '(|(cn=*{bit:s}*)(uid=*{bit:s}*))'.format(bit=word) for word in search_words if word.isalnum() )) - if ldap_query != "(|)": + if ldap_query != "(&)": # If none of the bits were legal, we do not perform the query with Connection(settings.LDAP_SERVER_URL) as conn: conn.search(