First working version of new Attribute/Tag categories
This commit is contained in:
parent
bdacc7beba
commit
630d31cac4
2 changed files with 4 additions and 5 deletions
|
|
@ -1807,7 +1807,7 @@ class CmdExamine(ObjManipCommand):
|
||||||
# we are only interested in specific attributes
|
# we are only interested in specific attributes
|
||||||
caller.msg(self.format_attributes(obj, attrname, crop=False))
|
caller.msg(self.format_attributes(obj, attrname, crop=False))
|
||||||
else:
|
else:
|
||||||
if obj.sessid:
|
if hasattr(obj, "sessid") and obj.sessid:
|
||||||
mergemode = "session"
|
mergemode = "session"
|
||||||
elif self.player_mode:
|
elif self.player_mode:
|
||||||
mergemode = "player"
|
mergemode = "player"
|
||||||
|
|
|
||||||
|
|
@ -218,8 +218,7 @@ class AttributeHandler(object):
|
||||||
|
|
||||||
def _recache(self):
|
def _recache(self):
|
||||||
self._cache = dict(("%s-%s" % (to_str(attr.db_key).lower(),
|
self._cache = dict(("%s-%s" % (to_str(attr.db_key).lower(),
|
||||||
to_str(attr.db_category,
|
attr.db_category.lower() if attr.db_category else None), attr)
|
||||||
force_string=True).lower()), attr)
|
|
||||||
for attr in _GA(self.obj, self._m2m_fieldname).filter(
|
for attr in _GA(self.obj, self._m2m_fieldname).filter(
|
||||||
db_model=self._model, db_attrtype=self._attrtype))
|
db_model=self._model, db_attrtype=self._attrtype))
|
||||||
#set_attr_cache(self.obj, self._cache) # currently only for testing
|
#set_attr_cache(self.obj, self._cache) # currently only for testing
|
||||||
|
|
@ -369,8 +368,8 @@ class AttributeHandler(object):
|
||||||
"""
|
"""
|
||||||
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
||||||
self._recache()
|
self._recache()
|
||||||
catkey = "-%s" % category.strip().lower() if category is not None else None
|
catkey = "-%s" % (category.strip().lower() if category is not None else None)
|
||||||
return [attr for key, attr in self._cache.items() if key.endswith(catkey)]
|
return [attr for key, attr in self._cache.items() if key and key.endswith(catkey)]
|
||||||
|
|
||||||
class NickHandler(AttributeHandler):
|
class NickHandler(AttributeHandler):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue