[python-ldap] Patch: Allow abort of ldif parsing

Michael Ströder michael at stroeder.com
Mon Apr 22 19:15:18 CEST 2013


Fassl, Michael wrote:
> I’ve extended the LDIFParser class to be able to abort parsing by returning
> „False“ in the „handle()“ method.
> 
> Reason I implemented this:
> 
> I need  to search for an object in a LDIF file containing ~ 8 million records
> and I want to stop on the first match.
> 
> Please share your thoughts about that.

You could easily implement your own custom class based on LDIFParser and raise
an abort exception in your custom method handle().

=> no need for this patch

Also changing the result type of handle() is rather cumbersome.
I'd rather prefer a patch which implements a generator based on LDIFParser
inspired by ldap.resiter.ResultProcessor. Hmm, maybe I already have some code
for it somewhere on my hard disk...

Ciao, Michael.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3883 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20130422/25930a4c/attachment-0001.bin>


More information about the python-ldap mailing list