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) char = create_object(gendersub.GenderCharacter, key="Gendered", location=self.room1)
txt = "Test |p gender" txt = "Test |p gender"
self.assertEqual(gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender") self.assertEqual(gendersub._RE_GENDER_PRONOUN.sub(char._get_pronoun, txt), "Test their gender")
# test mail contrib
class TestMail(CommandTest):

View file

@ -290,7 +290,7 @@ class AttributeHandler(object):
# for this category before # for this category before
catkey = "-%s" % category catkey = "-%s" % category
if _TYPECLASS_AGGRESSIVE_CACHE and catkey in self._catcache: 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: else:
# we have to query to make this category up-date in the cache # we have to query to make this category up-date in the cache
query = {"%s__id" % self._model : self._objid, query = {"%s__id" % self._model : self._objid,