From 93d590fdea9f510bacc18ca2a60535842dd7a292 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 30 Mar 2018 10:46:49 -0700 Subject: [PATCH] UserMapping: check for lower_nick rather than isinstance(userobj, User) This makes classes reload-safe again. --- classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes.py b/classes.py index e044cb9..dcdc8b6 100644 --- a/classes.py +++ b/classes.py @@ -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)