mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 08:16:30 +01:00
Renamed key to tag
This commit is contained in:
parent
8c9f1aeaa8
commit
0b351cfa12
1 changed files with 6 additions and 6 deletions
|
|
@ -319,26 +319,26 @@ class TagHandler(object):
|
|||
getattr(self.obj, self._m2m_fieldname).add(tagobj)
|
||||
self._setcache(tagstr, category, tagobj)
|
||||
|
||||
def has(self, key=None, category=None, return_list=False):
|
||||
def has(self, tag=None, category=None, return_list=False):
|
||||
"""
|
||||
Checks if the given Tag (or list of Tags) exists on the object.
|
||||
|
||||
Args:
|
||||
key (str or iterable): The Tag key or keys to check for.
|
||||
tag (str or iterable): The Tag key or tags to check for.
|
||||
If `None`, search by category.
|
||||
category (str or None): Limit the check to Tags with this
|
||||
category (note, that `None` is the default category).
|
||||
|
||||
Returns:
|
||||
has_tag (bool or list): If the Tag exists on this object or not.
|
||||
If `key` was given as an iterable then the return is a list of booleans.
|
||||
If `tag` was given as an iterable then the return is a list of booleans.
|
||||
|
||||
"""
|
||||
ret = []
|
||||
category = category.strip().lower() if category is not None else None
|
||||
for key_str in make_iter(key):
|
||||
key_str = key_str.strip().lower()
|
||||
ret.extend(bool(tag) for tag in self._getcache(key_str, category))
|
||||
for tag_str in make_iter(tag):
|
||||
tag_str = tag_str.strip().lower()
|
||||
ret.extend(bool(tag) for tag in self._getcache(tag_str, category))
|
||||
|
||||
if return_list:
|
||||
return ret
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue