change in python-ldap method?

Michael Ströder michael at
Tue Feb 26 17:54:36 CET 2002

Cc:-ed again to python-ldap-dev list since it might be interesting for 
others too.

Joe Little wrote:
> Do you use search filters with \+ in it?

Yes, I've tested the group admin feature of web2ldap editing group 
membership of entries which have + (better say escaped \+) in their DN 
string representation. The filter also contained \+ but did not raise 
any filter error exception.
As I said there are some bugs in web2ldap (0.10.3 as of this writing) 
concerning + in DNs which I fixed this morning. But they were unrelated 
to constructing search filters.

> Is there a method that you are using the generate your search
> string that strips the escapes out? The problem here is that I don't strip
> them out.. and feel I should have to :)

Don't strip them out. Pass the DN as assertion value right into your 
routine escaping the special chars for search filters. Then build the 
filter with the result. Watch out for the use of 
ldaputil.base.escape_filter_chars() in pylib/w2lapp/ of 
current web2ldap distribution.

Another thing is if you want to compare attribute values within your 
client. For such a string comparison you have to unescape the attribute 
values *after* completely decomposing the DN with ldap.explode_dn() and 
ldap.explode_rdn(). I've started to implement a function for that.

Ciao, Michael.

More information about the python-ldap mailing list