The `UserDictCase` class is a dictionary with case insensitive keys. Since it's inherited from `UserDict` it can be passed to method/functions expecting a "classic" python dictionary.
Unfortunately `UserDictCase` behaved in a different way when the specified key was not found: rather than raising a `KeyError` exception it just returned `None`. That broke duck typing in some places where a `KeyError` was expected and it also hid errors in other parts of the code (because no exception was being raised). This commit ensures `UserDictCase` has the same behaviour of python's dictionary. The change could break some parts of the code which took this bug as a feature. The python unit tests under 'backend/test' and 'backend/satellite_tools' are still passing. --- client/rhel/rhnlib/rhn/UserDictCase.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/rhel/rhnlib/rhn/UserDictCase.py b/client/rhel/rhnlib/rhn/UserDictCase.py index cb55674..c4b8dd6 100644 --- a/client/rhel/rhnlib/rhn/UserDictCase.py +++ b/client/rhel/rhnlib/rhn/UserDictCase.py @@ -41,8 +41,6 @@ class UserDictCase(UserDict): def __getitem__(self, key): key = self.__lower_string(key) - if not self.data.has_key(key): - return None return self.data[key] get = __getitem__ -- 1.8.1.4 _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel