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:
|
if key:
|
||||||
cachekey = "%s-%s" % (key, category)
|
cachekey = "%s-%s" % (key, category)
|
||||||
attr = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None)
|
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
|
return [attr] # return cached entity
|
||||||
else:
|
else:
|
||||||
query = {"%s__id" % self._model : self._objid,
|
query = {"%s__id" % self._model : self._objid,
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,11 @@ class TagHandler(object):
|
||||||
if key:
|
if key:
|
||||||
cachekey = "%s-%s" % (key, category)
|
cachekey = "%s-%s" % (key, category)
|
||||||
tag = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None)
|
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
|
return [tag] # return cached entity
|
||||||
else:
|
else:
|
||||||
query = {"%s__id" % self._model : self._objid,
|
query = {"%s__id" % self._model : self._objid,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue