Ldap module and base64 oncoding

Michael Ströder michael at stroeder.com
Tue May 28 03:45:32 EDT 2013


Joseph L. Casale wrote:
> I had some time today, so I attempted to open the ldif files in binary mode to simply
> work with the raw byte strings but the moment the first entry was parsed, parse()
> stumbled on a character in the first entries dict and passed a dn of None for the last half?

Without seeing the LDIF data and your code I can't tell what's going on.

> If the option to avoid worrying about decoding and encoding could work, I would be
> happy to process the whole lot in byte strings. Any idea what may cause this?

I would not claim that module 'ldif' has really awesome docs.
But did you follow the example with LDIFParser in the docs?

http://www.python-ldap.org/doc/html/ldif.html#example

It illustrates that for LDIF stream processing one basically derives a class
from ldif.LDIFParser overriding method handle(). The most basic test would be
something like this:

[..]
   def handle(self,dn,entry):
     print '***dn',repr(dn)
     pprint.pprint(entry)

And then carefully look at the output.

Ciao, Michael.




More information about the Python-list mailing list