Eliminate type error on search_s

Guard the list comprehension to eliminate 'None' valued keys from
the attrlist from causing an exception when trying to iterate on
the None singleton.

related-bug: #1231772
Change-Id: I823a53d100b5e4210c767507e3233b61ed372068
This commit is contained in:
Morgan Fainberg 2013-09-26 19:41:26 -07:00 committed by Brant Knudson
parent 5db7c43f4f
commit 1db2618601
1 changed files with 2 additions and 1 deletions

View File

@ -556,7 +556,8 @@ class LdapWrapper(object):
# allows us to set mapped attributes to "None" as defaults in config.
# Without this filtering, the ldap query would raise a TypeError since
# attrlist is expected to be an iterable of strings.
attrlist = [attr for attr in attrlist if attr is not None]
if attrlist is not None:
attrlist = [attr for attr in attrlist if attr is not None]
LOG.debug(_(
'LDAP search: dn=%(dn)s, scope=%(scope)s, query=%(query)s, '
'attrs=%(attrlist)s') % {