Updated Lib/ldif.py

Michael Ströder michael at stroeder.com
Tue May 8 14:28:19 CEST 2001


Cc:-ed to python-ldap-dev list since it might be interesting for
others...

Michael Schwartz wrote:
> 
> On Tue, 8 May 2001, Michael [iso-8859-1] Ströder wrote:
> 
> > Ah, ldif.CreateLDIF() does not add the necessary empty line to
> > separate entries.
> >
> That's great that you found the bug.

There seem to be a misunderstanding. This is an intended and
documented behaviour. I'm not sure why I left it out but there was
some reason (probably for having the possibility to add comment
lines with LDIF 1 format).

See web2ldap's module w2lsearch.py on how to write LDIF. Here's the
relevant excerpt.

------------------------ snip ------------------------
    # async search initiated before...

    result_type,result_dnlist = ls.l.result(ldap_msgid,0)
    while result_dnlist:
      for dn,entry in result_dnlist:
	outf.write('%s\n' %
ldif.CreateLDIF(dn,entry,w2lcore.ldap_binaryattrkeys))
      result_type,result_dnlist = ls.l.result(ldap_msgid,0)

------------------------ snip ------------------------

Ciao, Michael.




More information about the python-ldap mailing list