[Freeipa-devel] Re: [PATCH] Add conversion of attribute name synonyms when generating modlists.

Pavel Zůna pzuna at redhat.com
Fri Jun 12 15:37:11 UTC 2009


Rob Crittenden wrote:
> Pavel Zuna wrote:
>> Patch 0003: Add conversion of attribute name synonyms when generating 
>> modlists.
>>
>> Fixes the bug with 'localityname' in host plugins and prevents similar 
>> bugs from happening.
>>
>> Pavel
> 
> I'm not sure I understand this patch. What is the purpose of 
> preferred_names? It looks that if this is set the the translation 
> doesn't actually happen (and this is always set).
> 
> rob

If preferred_names evaluate to True (if not None and not and empty 
list), then all attribute names equivalent to those in preferred names 
are converted to them. Otherwise all attributes are converted to their 
preferred synonym according to the schema.

For example:

a = {'locality': 'Brno'}
ldap.convert_attr_synonyms(a, ['localityname'])
# a == {'localityname': 'Brno'}
ldap.convert_attr_synonyms(a)
# a == {'l': 'Brno'}

I did it this way, so when generating a modlist, we can convert 
attributes as returned by python-ldap to what the plugin uses.

Pavel




More information about the Freeipa-devel mailing list