Update utils.search argument strings. Resolves #2106.
This commit is contained in:
parent
0281105b4a
commit
399dc3640d
2 changed files with 49 additions and 21 deletions
|
|
@ -205,27 +205,31 @@ help_entries = search_help
|
|||
# not the attribute object itself (this is usually what you want)
|
||||
|
||||
|
||||
def search_object_attribute(key=None, category=None, value=None, strvalue=None):
|
||||
def search_object_attribute(key=None, category=None, value=None,
|
||||
strvalue=None, attrtype=None, **kwargs):
|
||||
return ObjectDB.objects.get_by_attribute(
|
||||
key=key, category=category, value=value, strvalue=strvalue
|
||||
key=key, category=category, value=value, strvalue=strvalue, attrtype=attrtype, **kwargs
|
||||
)
|
||||
|
||||
|
||||
def search_account_attribute(key=None, category=None, value=None, strvalue=None):
|
||||
def search_account_attribute(key=None, category=None, value=None,
|
||||
strvalue=None, attrtype=None, **kwargs):
|
||||
return AccountDB.objects.get_by_attribute(
|
||||
key=key, category=category, value=value, strvalue=strvalue
|
||||
key=key, category=category, value=value, strvalue=strvalue, attrtype=attrtype, **kwargs
|
||||
)
|
||||
|
||||
|
||||
def search_script_attribute(key=None, category=None, value=None, strvalue=None):
|
||||
def search_script_attribute(key=None, category=None, value=None,
|
||||
strvalue=None, attrtype=None, **kwargs):
|
||||
return ScriptDB.objects.get_by_attribute(
|
||||
key=key, category=category, value=value, strvalue=strvalue
|
||||
key=key, category=category, value=value, strvalue=strvalue, attrtype=attrtype, **kwargs
|
||||
)
|
||||
|
||||
|
||||
def search_channel_attribute(key=None, category=None, value=None, strvalue=None):
|
||||
def search_channel_attribute(key=None, category=None, value=None,
|
||||
strvalue=None, attrtype=None, **kwargs):
|
||||
return Channel.objects.get_by_attribute(
|
||||
key=key, category=category, value=value, strvalue=strvalue
|
||||
key=key, category=category, value=value, strvalue=strvalue, attrtype=attrtype, **kwargs
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -243,7 +247,7 @@ search_attribute_object = ObjectDB.objects.get_attribute
|
|||
# object itself (this is usually what you want)
|
||||
|
||||
|
||||
def search_object_by_tag(key=None, category=None):
|
||||
def search_object_by_tag(key=None, category=None, tagtype=None, **kwargs):
|
||||
"""
|
||||
Find object based on tag or category.
|
||||
|
||||
|
|
@ -252,6 +256,11 @@ def search_object_by_tag(key=None, category=None):
|
|||
category (str, optional): The category of tag
|
||||
to search for. If not set, uncategorized
|
||||
tags will be searched.
|
||||
tagtype (str, optional): 'type' of Tag, by default
|
||||
this is either `None` (a normal Tag), `alias` or
|
||||
`permission`. This always apply to all queried tags.
|
||||
kwargs (any): Other optional parameter that may be supported
|
||||
by the manager method.
|
||||
|
||||
Returns:
|
||||
matches (list): List of Objects with tags matching
|
||||
|
|
@ -259,13 +268,13 @@ def search_object_by_tag(key=None, category=None):
|
|||
matches were found.
|
||||
|
||||
"""
|
||||
return ObjectDB.objects.get_by_tag(key=key, category=category)
|
||||
return ObjectDB.objects.get_by_tag(key=key, category=category, tagtype=tagtype, **kwargs)
|
||||
|
||||
|
||||
search_tag = search_object_by_tag # this is the most common case
|
||||
|
||||
|
||||
def search_account_tag(key=None, category=None):
|
||||
def search_account_tag(key=None, category=None, tagtype=None, **kwargs):
|
||||
"""
|
||||
Find account based on tag or category.
|
||||
|
||||
|
|
@ -274,6 +283,11 @@ def search_account_tag(key=None, category=None):
|
|||
category (str, optional): The category of tag
|
||||
to search for. If not set, uncategorized
|
||||
tags will be searched.
|
||||
tagtype (str, optional): 'type' of Tag, by default
|
||||
this is either `None` (a normal Tag), `alias` or
|
||||
`permission`. This always apply to all queried tags.
|
||||
kwargs (any): Other optional parameter that may be supported
|
||||
by the manager method.
|
||||
|
||||
Returns:
|
||||
matches (list): List of Accounts with tags matching
|
||||
|
|
@ -281,10 +295,10 @@ def search_account_tag(key=None, category=None):
|
|||
matches were found.
|
||||
|
||||
"""
|
||||
return AccountDB.objects.get_by_tag(key=key, category=category)
|
||||
return AccountDB.objects.get_by_tag(key=key, category=category, tagtype=tagtype, **kwargs)
|
||||
|
||||
|
||||
def search_script_tag(key=None, category=None):
|
||||
def search_script_tag(key=None, category=None, tagtype=None, **kwargs):
|
||||
"""
|
||||
Find script based on tag or category.
|
||||
|
||||
|
|
@ -293,6 +307,11 @@ def search_script_tag(key=None, category=None):
|
|||
category (str, optional): The category of tag
|
||||
to search for. If not set, uncategorized
|
||||
tags will be searched.
|
||||
tagtype (str, optional): 'type' of Tag, by default
|
||||
this is either `None` (a normal Tag), `alias` or
|
||||
`permission`. This always apply to all queried tags.
|
||||
kwargs (any): Other optional parameter that may be supported
|
||||
by the manager method.
|
||||
|
||||
Returns:
|
||||
matches (list): List of Scripts with tags matching
|
||||
|
|
@ -300,10 +319,10 @@ def search_script_tag(key=None, category=None):
|
|||
matches were found.
|
||||
|
||||
"""
|
||||
return ScriptDB.objects.get_by_tag(key=key, category=category)
|
||||
return ScriptDB.objects.get_by_tag(key=key, category=category, tagtype=tagtype, **kwargs)
|
||||
|
||||
|
||||
def search_channel_tag(key=None, category=None):
|
||||
def search_channel_tag(key=None, category=None, tagtype=None, **kwargs):
|
||||
"""
|
||||
Find channel based on tag or category.
|
||||
|
||||
|
|
@ -312,6 +331,11 @@ def search_channel_tag(key=None, category=None):
|
|||
category (str, optional): The category of tag
|
||||
to search for. If not set, uncategorized
|
||||
tags will be searched.
|
||||
tagtype (str, optional): 'type' of Tag, by default
|
||||
this is either `None` (a normal Tag), `alias` or
|
||||
`permission`. This always apply to all queried tags.
|
||||
kwargs (any): Other optional parameter that may be supported
|
||||
by the manager method.
|
||||
|
||||
Returns:
|
||||
matches (list): List of Channels with tags matching
|
||||
|
|
@ -319,7 +343,7 @@ def search_channel_tag(key=None, category=None):
|
|||
matches were found.
|
||||
|
||||
"""
|
||||
return Channel.objects.get_by_tag(key=key, category=category)
|
||||
return Channel.objects.get_by_tag(key=key, category=category, tagtype=tagtype, **kwargs)
|
||||
|
||||
|
||||
# search for tag objects (not the objects they are attached to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue