本文整理汇总了Python中pyasm.search.Search.get_regex_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Search.get_regex_filter方法的具体用法?Python Search.get_regex_filter怎么用?Python Search.get_regex_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.Search
的用法示例。
在下文中一共展示了Search.get_regex_filter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_regex_filter [as 别名]
def get_display(my):
#defining init is better than get_display() for this kind of SelectWdg
search = Search( SearchType.SEARCH_TYPE )
if my.mode == None or my.mode == my.ALL_BUT_STHPW:
# always add the login / login group search types
filter = search.get_regex_filter("search_type", "login|task|note|timecard|trigger|milestone", "EQ")
no_sthpw_filter = search.get_regex_filter("search_type", "^(sthpw).*", "NEQ")
search.add_where('%s or %s' %(filter, no_sthpw_filter))
elif my.mode == my.CURRENT_PROJECT:
project = Project.get()
project_code = project.get_code()
#project_type = project.get_project_type().get_type()
project_type = project.get_value("type")
search.add_where("\"namespace\" in ('%s','%s') " % (project_type, project_code))
search.add_order_by("search_type")
search_types = search.get_sobjects()
values = SObject.get_values(search_types, 'search_type')
labels = [ x.get_label() for x in search_types ]
values.append('CustomLayoutWdg')
labels.append('CustomLayoutWdg')
my.set_option('values', values)
my.set_option('labels', labels)
#my.set_search_for_options(search, "search_type", "get_label()")
my.add_empty_option(label='-- Select Search Type --')
return super(SearchTypeSelectWdg, my).get_display()
示例2: alter_search
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_regex_filter [as 别名]
def alter_search(my, search):
status_value = my.get_value()
if status_value == "artist":
where = "(status is NULL or %s)" \
% Search.get_regex_filter('status', status_value)
search.add_where( where )
elif status_value != 'all':
where = Search.get_regex_filter('status', status_value)
search.add_where( where )
示例3: init
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_regex_filter [as 别名]
def init(my):
#defining init is better than get_display() for this kind of SelectWdg
search = Search( SearchType.SEARCH_TYPE )
if my.mode == None or my.mode == my.ALL_BUT_STHPW:
# always add the login / login group search types
filter = search.get_regex_filter("search_type", "login|task|note|timecard|milestone", "EQ")
no_sthpw_filter = search.get_regex_filter("search_type", "^(sthpw).*", "NEQ")
search.add_where('%s or %s' %(filter, no_sthpw_filter))
elif my.mode == my.CURRENT_PROJECT:
project = Project.get()
project_code = project.get_code()
#project_type = project.get_project_type().get_type()
project_type = project.get_value("type")
search.add_where("\"namespace\" in ('%s','%s') " % (project_type, project_code))
search.add_order_by("search_type")
my.set_search_for_options(search, "search_type", "get_label()")
my.add_empty_option(label='-- Select Search Type --')
示例4: get_config_wdg
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_regex_filter [as 别名]
def get_config_wdg(my):
widget = Widget()
search = Search("sthpw/widget_config")
div = DivWdg(css="filter_box")
span = SpanWdg(css="med")
span.add("Search Type: ")
select = FilterSelectWdg("config_search_type")
select.add_empty_option("-- Select --")
search_type_search = Search("sthpw/search_object")
search_type_search.add_order_by("search_type")
span.add(select)
project = Project.get()
project_type = project.get_base_type()
filter = search.get_regex_filter("search_type", "login|task|note|timecard", "EQ")
search_type_search.add_where(
"""
namespace = '%s' or namespace = '%s' or %s
"""
% (project_type, project.get_code(), filter)
)
select.set_search_for_options(search_type_search, value_column="search_type")
div.add(span)
search_type_value = select.get_value()
span = SpanWdg()
view_text = TextWdg("view")
view_text.set_persist_on_submit()
span.add("View: ")
span.add(view_text)
div.add(span)
widget.add(div)
view = view_text.get_value()
if view:
search.add_filter("view", view)
if search_type_value:
search.add_filter("search_type", search_type_value)
table = TableWdg("sthpw/widget_config")
table.set_search(search)
widget.add(table)
return widget
示例5: alter_search
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_regex_filter [as 别名]
def alter_search(my, search):
asset_code = my.asset_code_select.get_value()
if asset_code != "":
search.add_filter("asset_code", asset_code)
value = my.select.get_value()
if value != "":
search.add_filter("category", value)
value = my.text.get_value()
if not value or value == "":
return
value = value.lower()
values = value.split(" ")
columns = my.get_search_columns()
for value in values:
expr = [Search.get_regex_filter(x, value) for x in columns]
expr_full = " or ".join(expr)
search.add_where("(%s)" % expr_full)