mirror of
https://github.com/evennia/evennia.git
synced 2026-04-06 16:44:08 +02:00
More elaborate catch of the .pk property for Attributes and Tags.
This commit is contained in:
parent
fb7e5762a6
commit
afa4e74322
2 changed files with 10 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue