Python-LDAP-dev digest, Vol 1 #876 - 1 msg

Michael Ströder michael at stroeder.com
Thu Nov 11 09:10:31 CET 2004


Brian Beck wrote:
> Bertrand Croq <bertrand.croq at freeskop.com> wrote:
>> 
>>  I wasn't able to find a function to escape chars in DN strings, so I
>>wrote this one (based on escape_filter_chars):
>>
>>def escape_dn_chars(s):
>>[..]
> 
> Alternatively, wouldn't using urllib.quote do nearly the same thing? 
> The only difference I notice is that quote uses a % as an escape
> character instead of \.  That's easily changed...

I strongly dislike abusing urllib.quote since RFC2253 clearly defines a 
certain set of special chars in DNs which surely differs from special 
chars in URLs.

 > Or is there something about LDAP URIs that I'm missing?

We're talking about LDAP DN string representation here (see RFC2253). 
Not about LDAP URLs (as described in RFC2255). LDAP URLs are handled 
through python-ldap's module 'ldapurl'.

Ciao, Michael.



More information about the python-ldap mailing list