Univention Bugzilla – Bug 42787
UDM: has_key() and __contains__ differ
Last modified: 2021-04-14 10:37:19 CEST
The methods hay_key() and __contains__ in UDM's base class simpleLDAP differ. __contains__() checks if the key exists in the modules property_descriptions. hay_key() does the same plus also checks if the option this property requires is activated at the current object. The use of has_key() is deprecated and python3 removed this. We should unify the behavior. IMO __contains__ should do what hay_key() currently does. If we change this we can replace every occurence of "object.hay_key(key)" with "key in object". Some tools like autopep8 are doing this automatically. Some automatic style checkers like pep8 are blaming the use of has_key().
We could add a method has_property() which replaces the current behavior of has_key().