diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py index a54fb952f9..376217ba64 100644 --- a/evennia/typeclasses/attributes.py +++ b/evennia/typeclasses/attributes.py @@ -251,7 +251,11 @@ class AttributeHandler(object): if key: cachekey = "%s-%s" % (key, category) attr = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None) - if attr and hasattr(attr, "pk") and attr.pk: + if attr and (not hasattr(attr, "pk") and attr.pk is None): + # clear out Attributes deleted from elsewhere. We must search this anew. + attr = None + del self._cache[cachekey] + if attr: return [attr] # return cached entity else: query = {"%s__id" % self._model : self._objid, diff --git a/evennia/typeclasses/tags.py b/evennia/typeclasses/tags.py index 6efdbc9328..6758e3fe13 100644 --- a/evennia/typeclasses/tags.py +++ b/evennia/typeclasses/tags.py @@ -140,7 +140,11 @@ class TagHandler(object): if key: cachekey = "%s-%s" % (key, category) tag = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None) - if tag and hasattr(tag, "pk") and tag.pk: + if tag and (not hasattr(tag, "pk") and tag.pk is None): + # clear out Tags deleted from elsewhere. We must search this anew. + tag = None + del self._cache[cachekey] + if tag: return [tag] # return cached entity else: query = {"%s__id" % self._model : self._objid,