[python-ldap] syncrepl fix for pyasn1 >= 0.3
ilya at glas.net
Tue Nov 7 17:21:48 EST 2017
Would it be possible to bump pyasn1 version requirement at python-ldap
to 0.3+ and remove all these `if xxx is None` comparisons? I guess not
because that might be against versioning policies.
To my understanding the `is` operator can't be overloaded because it is
a memory address comparison.
May be we could inject the `NoValue` class along with the `noValue`
singleton object into pyasn1 from the python-ldap code at import time:
from pyasn1.type import univ
univ.NoValue = univ.noValue = None
What would let us remove all these nasty `if xxx is None or ... `
pieces from python-ldap code.
Would that work?
On 11/07/2017 10:30 PM, Michael Ströder wrote:
> Christian Heimes wrote:
>> On 2017-11-07 13:58, Ilya Etingof wrote:
>>> Exactly! This patch should not compromise current compatibility
>>> situation, but only extend it to current pyasn1 API.
>>> Thank you Christian for porting the patch!
>> Here is a new patch. I tested it with FreeIPA's ipa-dnskeysyncd.
> I've looked at this patch a bit closer.
> Hmmpf! We should have automated tests for all the control stuff. In case
> of persistent search this is not so easy because OpenLDAP's slapd does
> not support it.
> I'd also like to know whether there could be a more elegant solution to
> avoid all the additional if-conditions. I'm concerned that it makes
> maintaining the code even more complicated.
> Would it be possible to try importing this new sentinel object and
> mimique its behaviour with a small custom class in case of older pyasn1
> version without this sentinel object?
> Or could this new sentinel object made compatible with a check "is None"?
> Ciao, Michael.
More information about the python-ldap