forked from DGNum/gestioCOF
Replace list comprehensions by iterators in dal
This commit is contained in:
parent
55b67f38c8
commit
4899bba1f7
2 changed files with 4 additions and 4 deletions
|
@ -56,10 +56,10 @@ def autocomplete(request):
|
||||||
# Fetching data from the SPI
|
# Fetching data from the SPI
|
||||||
if hasattr(settings, 'LDAP_SERVER_URL'):
|
if hasattr(settings, 'LDAP_SERVER_URL'):
|
||||||
# Fetching
|
# Fetching
|
||||||
ldap_query = '(|{:s})'.format(''.join([
|
ldap_query = '(|{:s})'.format(''.join(
|
||||||
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=bit)
|
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=bit)
|
||||||
for bit in bits if bit.isalnum()
|
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
|
# If none of the bits were legal, we do not perform the query
|
||||||
with Connection(settings.LDAP_SERVER_URL) as conn:
|
with Connection(settings.LDAP_SERVER_URL) as conn:
|
||||||
|
|
|
@ -75,10 +75,10 @@ def account_create(request):
|
||||||
# Fetching data from the SPI
|
# Fetching data from the SPI
|
||||||
if hasattr(settings, 'LDAP_SERVER_URL'):
|
if hasattr(settings, 'LDAP_SERVER_URL'):
|
||||||
# Fetching
|
# Fetching
|
||||||
ldap_query = '(|{:s})'.format(''.join([
|
ldap_query = '(|{:s})'.format(''.join(
|
||||||
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=word)
|
'(cn=*{bit:s}*)(uid=*{bit:s}*)'.format(bit=word)
|
||||||
for word in search_words if word.isalnum()
|
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
|
# If none of the bits were legal, we do not perform the query
|
||||||
with Connection(settings.LDAP_SERVER_URL) as conn:
|
with Connection(settings.LDAP_SERVER_URL) as conn:
|
||||||
|
|
Loading…
Reference in a new issue