mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +01:00
UserMapping: check for lower_nick rather than isinstance(userobj, User)
This makes classes reload-safe again.
This commit is contained in:
parent
be8e4be49d
commit
93d590fdea
@ -137,7 +137,7 @@ class UserMapping(collections.abc.MutableMapping, structures.CopyWrapper):
|
|||||||
return self._data[key]
|
return self._data[key]
|
||||||
|
|
||||||
def __setitem__(self, key, userobj):
|
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:
|
if key in self._data:
|
||||||
log.warning('(%s) Attempting to replace User object for %r: %r -> %r', self.name,
|
log.warning('(%s) Attempting to replace User object for %r: %r -> %r', self.name,
|
||||||
key, self._data.get(key), userobj)
|
key, self._data.get(key), userobj)
|
||||||
|
Loading…
Reference in New Issue
Block a user