[Freeipa-devel] [PATCH] Add missing _sasl_auth variable and fix some minor bugs, all in ldap2.

Pavel Zuna pzuna at redhat.com
Tue Apr 21 14:40:17 UTC 2009


Rob Crittenden wrote:
> Pavel Zuna wrote:
>> ldap2 currently isn't functional without this patch.
>>
>> Pavel
> 
> This patch does a lot more than just add the _sasl_auth variable. What 
> is the purpose of the other changes?
Sorry my bad, I made more changes and forgot about it when making the patch. 
I'll make separate patches for the other changes, namely:

- added a new keyword argument to ldap2.make_filter and 
ldap2.make_filter_from_attr, the boolean 'exact'.

If it's True, filter is build as (attribute=value), else (attribute=*value*).

- moved ldap2.__handle_errors to _handle_errors outside of the ldap2 class

It can't be in the class itself, because it is used in the _load_schema 
function. I didn't notice this at first.

OT: I don't like using private ('__' prefix) when not absolutely necessary. I 
think it's a little bit unpythonic. If an name starts with _, everyone knows 
it's not indented to be used outside the scope/class it was defined in, but they 
still have the freedom to do as they please at their own risk.

- when raising exceptions with no arguments, use 'raise ExceptionClass' instead 
of 'raise ExceptionClass()'

Well, that's just a matter of preference I guess and I only changed it to make 
it more consistent with the way I usually write it. I'll change it back, since 
the second form seems to be in favor in freeIPA code.

> IIRC Jason has said it is good practice to include () when raising an 
> exception.
> 
> rob

Pavel




More information about the Freeipa-devel mailing list