Make attribute cache behavior consistent with the non-cached return when returning non-found objects as per #1226.

This commit is contained in:
Griatch 2017-02-19 17:36:35 +01:00
parent 7e762245c8
commit 23cfd3ba17
2 changed files with 7 additions and 2 deletions

View file

@ -518,3 +518,8 @@ class TestGenderSub(CommandTest):
char = create_object(gendersub.GenderCharacter, key="Gendered", location=self.room1)
txt = "Test |p gender"
self.assertEqual(gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender")
# test mail contrib
class TestMail(CommandTest):

View file

@ -222,7 +222,7 @@ class AttributeHandler(object):
attr.db_category.lower() if attr.db_category else None),
attr) for attr in attrs)
self._cache_complete = True
def _getcache(self, key=None, category=None):
"""
Retrieve from cache or database (always caches)
@ -290,7 +290,7 @@ class AttributeHandler(object):
# for this category before
catkey = "-%s" % category
if _TYPECLASS_AGGRESSIVE_CACHE and catkey in self._catcache:
return [attr for key, attr in self._cache.items() if key.endswith(catkey)]
return [attr for key, attr in self._cache.items() if key.endswith(catkey) and attr]
else:
# we have to query to make this category up-date in the cache
query = {"%s__id" % self._model : self._objid,