From 1db2618601b38587a0b6eb3e1790a1c2de994000 Mon Sep 17 00:00:00 2001 From: Morgan Fainberg Date: Thu, 26 Sep 2013 19:41:26 -0700 Subject: [PATCH] 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 --- keystone/common/ldap/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keystone/common/ldap/core.py b/keystone/common/ldap/core.py index bdde59557..2777ee194 100644 --- a/keystone/common/ldap/core.py +++ b/keystone/common/ldap/core.py @@ -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') % {