diff --git a/src/commands/default/building.py b/src/commands/default/building.py index 28e585d10..a9f137820 100644 --- a/src/commands/default/building.py +++ b/src/commands/default/building.py @@ -1807,7 +1807,7 @@ class CmdExamine(ObjManipCommand): # we are only interested in specific attributes caller.msg(self.format_attributes(obj, attrname, crop=False)) else: - if obj.sessid: + if hasattr(obj, "sessid") and obj.sessid: mergemode = "session" elif self.player_mode: mergemode = "player" diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index cdac56c3f..5a047fede 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -218,8 +218,7 @@ class AttributeHandler(object): def _recache(self): self._cache = dict(("%s-%s" % (to_str(attr.db_key).lower(), - to_str(attr.db_category, - force_string=True).lower()), attr) + attr.db_category.lower() if attr.db_category else None), attr) for attr in _GA(self.obj, self._m2m_fieldname).filter( db_model=self._model, db_attrtype=self._attrtype)) #set_attr_cache(self.obj, self._cache) # currently only for testing @@ -369,8 +368,8 @@ class AttributeHandler(object): """ if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE: self._recache() - catkey = "-%s" % category.strip().lower() if category is not None else None - return [attr for key, attr in self._cache.items() if key.endswith(catkey)] + catkey = "-%s" % (category.strip().lower() if category is not None else None) + return [attr for key, attr in self._cache.items() if key and key.endswith(catkey)] class NickHandler(AttributeHandler): """