Problem with names that include ","

Christoph Holtermann c.holtermann at gmx.de
Tue Jun 2 14:19:57 CEST 2009


Hello !

Still working on commas in dn. When I now look
at the functions supplied in python ldap there is
for example :

>>> a='cn="lehmann, Andreas",dc=Adressbuch'
>>> b=ldap.dn.str2dn(a)
>>> b
[[('cn', 'lehmann, Andreas', 1)], [('dc', 'Adressbuch', 1)]]
>>> ldap.dn.dn2str(b)
'cn=lehmann\\, Andreas,dc=Adressbuch'
>>> ldap.dn.explode_dn(a)
['cn=lehmann\\, Andreas', 'dc=Adressbuch']

So Python-LDAP itself goes this nonconform way of
using escape sequences if I get it right.
I guess it's quite easy using dn2str and then
converting it to a new string using "" instead of using
str2dn or explode_dn that lead to ESC-Codes.
But wouldn't it make sense to change the
functions ?

regards,

C. Holtermann




More information about the python-ldap mailing list