From fb7e5762a63df01e09d9827e528d5600e2f497fd Mon Sep 17 00:00:00 2001 From: Griatch Date: Thu, 3 Nov 2016 20:12:07 +0100 Subject: [PATCH] Add .pk check to Tag/AttributeHandler when returning cached Tags and Attributes. --- evennia/typeclasses/attributes.py | 2 +- evennia/typeclasses/tags.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/typeclasses/attributes.py b/evennia/typeclasses/attributes.py index 0ed045b41f..a54fb952f9 100644 --- a/evennia/typeclasses/attributes.py +++ b/evennia/typeclasses/attributes.py @@ -251,7 +251,7 @@ class AttributeHandler(object): if key: cachekey = "%s-%s" % (key, category) attr = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None) - if attr: + if attr and hasattr(attr, "pk") and attr.pk: 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 e6f9b8e5bf..6efdbc9328 100644 --- a/evennia/typeclasses/tags.py +++ b/evennia/typeclasses/tags.py @@ -140,7 +140,7 @@ class TagHandler(object): if key: cachekey = "%s-%s" % (key, category) tag = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None) - if tag: + if tag and hasattr(tag, "pk") and tag.pk: return [tag] # return cached entity else: query = {"%s__id" % self._model : self._objid,