mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Make attribute cache behavior consistent with the non-cached return when returning non-found objects as per #1226.
This commit is contained in:
parent
7e762245c8
commit
23cfd3ba17
2 changed files with 7 additions and 2 deletions
|
|
@ -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):
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue