From: <mi...@st...> - 2004-11-11 08:18:44
|
Brian Beck wrote: > Bertrand Croq <ber...@fr...> 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. |