Skip to content

Commit

Permalink
Eliminate type error on search_s
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Morgan Fainberg authored and Brant Knudson committed Sep 27, 2013
1 parent 5db7c43 commit 1db2618
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keystone/common/ldap/core.py
Expand Up @@ -556,7 +556,8 @@ def search_s(self, dn, scope, query, attrlist=None):
# 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') % {
Expand Down

0 comments on commit 1db2618

Please sign in to comment.