3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 05:32:51 +01:00

UserMapping: check for lower_nick rather than isinstance(userobj, User)

This makes classes reload-safe again.
This commit is contained in:
James Lu 2018-03-30 10:46:49 -07:00
parent be8e4be49d
commit 93d590fdea

View File

@ -137,7 +137,7 @@ class UserMapping(collections.abc.MutableMapping, structures.CopyWrapper):
return self._data[key]
def __setitem__(self, key, userobj):
assert isinstance(userobj, User), "UserMapping can only hold User objects"
assert hasattr(userobj, 'lower_nick'), "Cannot add object without lower_nick attribute to UserMapping"
if key in self._data:
log.warning('(%s) Attempting to replace User object for %r: %r -> %r', self.name,
key, self._data.get(key), userobj)