escape_dn_chars

Bertrand Croq bertrand.croq at freeskop.com
Wed Nov 10 15:22:04 CET 2004


Hi,
  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):
	s = s.replace('\\', r'\5C')
	s = s.replace(',', r'\2C')
	s = s.replace('=', r'\3D')
	s = s.replace('+', r'\2B')
	return s

Feel free to use/modify it in python-ldap (license: PSFL, as
python-ldap)

-- 
Bertrand Croq - FreesKop - Avenue Robert Schuman - 35170 BRUZ (France)
http://www.freeskop.com/ - Tel: 02 99 05 04 56 - Fax: 02 99 05 96 40
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20041110/c4114d37/attachment.pgp>


More information about the python-ldap mailing list