[python-ldap] Adding msgid to LDAPError
Michael Ströder
michael at stroeder.com
Sat Sep 12 12:15:36 CEST 2015
Stephen J. Butler wrote:
> On Sat, Sep 12, 2015 at 4:51 AM, Michael Ströder <michael at stroeder.com
> <mailto:michael at stroeder.com>> wrote:
>
> But just a quick question: Why not attach the msgid to also LDAPError
> instances caused by write operations? Note that LDAP allows pipe-lining of
> requests. You can send several write operations and deal with the result code
> later. Your patch would be handy for those situations either.
>
> Should work there too. It doesn't make sense to attach msgid inside stuff
> like l_ldap_add_ext() because if it fails at that point there's no valid msgid
> to track. So I did it all in l_ldap_result4(), which should be generic enough
> to track any type of request, read or write.
Ah ok. Will test this.
> While you're at it you could also attach the response controls (plural!)
> returned by the server in the LDAPResult messages to the LDAPError instance.
>
> This would e.g. solve the case of a simple bind failing because of an expired
> password. Up to now the response control saying "password expired" cannot be
> extracted.
> Also OpenLDAP's experimental "What failed?" control would require this for
> determining what went wrong when using slapo-constraint, slapo-unique...
>
>
> That's an interesting thought. Certainly useful, but I might want to rework
> the patch into an LDAPerror and LDAPerrorExt
No, please not a different error class.
> so that we're constantly
> specifying parameters that aren't used. Or is the project OK with default
> parameters in the header file?
The following options would be ok for me:
1. Set LDAPError's response control class attribute to None (not 0 or '').
2. Don't set response control class attribute at all so the application has to
properly deal with AttributeError/KeyError exception.
I have to admin the LDAPError class stuff is quite hackish and error-prone.
Since I'm not a C programmer I could not really fix it.
Ciao, Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20150912/286be066/attachment.bin>
More information about the python-ldap
mailing list