def convert_ldap_result(ldap_result):
 py_result = []
 at_least_one_referral = False
 for (dn, attrs) in ldap_result:
  ldap_attrs = {}
  if (dn is None):
   at_least_one_referral = True
   continue
  for (kind, values) in attrs.items():
   try:
    val2py = (enabled2py if (kind == 'enabled') else ldap2py)
    ldap_attrs[kind] = [val2py(x) for x in values]
   except UnicodeDecodeError:
    LOG.debug('Unable to decode value for attribute %s', kind)
  py_result.append((utf8_decode(dn), ldap_attrs))
 if at_least_one_referral:
  LOG.debug('Referrals were returned and ignored. Enable referral chasing in keystone.conf via [ldap] chase_referrals')
 return py_result

def convert_ldap_result ( ldap_result ) : py_result = [ ] at_least_one_referral = False for ( dn , attrs ) in ldap_result : ldap_attrs = { } if ( dn is None ) : at_least_one_referral = True continue for ( kind , values ) in attrs . items ( ) : try : val2py = ( enabled2py if ( kind == 'enabled' ) else ldap2py ) ldap_attrs [ kind ] = [ val2py ( x ) for x in values ] except UnicodeDecodeError : LOG . debug ( 'Unable to decode value for attribute %s' , kind ) py_result . append ( ( utf8_decode ( dn ) , ldap_attrs ) ) if at_least_one_referral : LOG . debug ( 'Referrals were returned and ignored. Enable referral chasing in keystone.conf via [ldap] chase_referrals' ) return py_result
convert ldap search result to python types used by openstack .