mirror of
https://github.com/evennia/evennia.git
synced 2026-04-02 22:17:17 +02:00
Addded sorted returns of Tags, as per #534.
This commit is contained in:
parent
52eef63a84
commit
50e7b37191
1 changed files with 4 additions and 2 deletions
|
|
@ -463,11 +463,12 @@ class AttributeHandler(object):
|
|||
"""
|
||||
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
||||
self._recache()
|
||||
attrs = sorted(self._cache.values(), key=lambda o: o.id)
|
||||
if accessing_obj:
|
||||
return [attr for attr in self._cache.values()
|
||||
return [attr for attr in attrs
|
||||
if attr.access(accessing_obj, self._attredit, default=default_access)]
|
||||
else:
|
||||
return self._cache.values()
|
||||
return attrs
|
||||
|
||||
|
||||
class NickHandler(AttributeHandler):
|
||||
|
|
@ -706,6 +707,7 @@ class TagHandler(object):
|
|||
matches = self._cache.values()
|
||||
|
||||
if matches:
|
||||
matches = sorted(matches, key=lambda o: o.id)
|
||||
if return_key_and_category:
|
||||
# return tuple (key, category)
|
||||
return [(to_str(p.db_key), to_str(p.db_category)) for p in matches]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue