本文整理汇总了Python中pyasm.search.Search.do_search方法的典型用法代码示例。如果您正苦于以下问题:Python Search.do_search方法的具体用法?Python Search.do_search怎么用?Python Search.do_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.Search
的用法示例。
在下文中一共展示了Search.do_search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_by_search_type
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import do_search [as 别名]
def get_by_search_type(search_type):
search = Search(Template.SEARCH_TYPE)
search.add_filter("search_type", search_type)
search.add_order_by("timestamp desc")
return search.do_search()
示例2: handle_add_instance
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import do_search [as 别名]
def handle_add_instance(self, set):
WebContainer.register_cmd("pyasm.prod.web.SetCheckinCbk")
self.add(DivWdg("Comments:"))
textarea = TextAreaWdg("description")
textarea.set_attr("cols", "30")
textarea.set_attr("rows", "2")
self.add(textarea)
set_name = set.get_value("name")
button = ProdIconSubmitWdg(self.PUBLISH_BUTTON, long=True)
button.add_event("onclick", "if (checkin_set('%s','%s')!=true) return" \
% (set_name, set.get_code() ))
self.add(button)
# get all of the assets belonging to this set
search = Search("prod/asset")
search.add_regex_filter('code', set_name, op='EQ' )
set_assets = search.do_search()
示例3: init
# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import do_search [as 别名]
def init(my):
web = WebContainer.get_web()
search_type = web.get_form_value("search_type")
search_ids = web.get_form_values("search_ids")
download_types = web.get_form_values("download_types")
search = Search(search_type)
sobjects = []
if search_ids:
search.add_where("id in (%s)" % ", ".join(search_ids))
sobjects = search.do_search()
if not sobjects:
message = HtmlElement.p("No %s to download." % search.get_search_type_obj().get_title())
message.set_class("warning")
my.add(message)
return
download_wdg = DownloadWdg()
my.add(download_wdg)
outer_div = DivWdg(css="admin_main")
table = Table()
table.set_class("table")
# add download buttons
widget = HtmlElement.div()
# button = SubmitWdg("Download All")
# widget.add(button)
button = SubmitWdg("Download Selected")
widget.add(button)
tr, th = table.add_row_header(widget)
th.add_style("text-align: center")
# add all of the
# widget = HtmlElement.div()
# widget.add("<b>Download options:</b>")
# for type in download_types:
# widget.add( CheckboxWdg(type) )
# widget.add( type)
# tr, th = table.add_row_header(widget)
# th.add_style("text-align: center")
# add all of the sobjects
col = 0
for sobject in sobjects:
if col == 0 or col % 3 == 0:
table.add_row()
search_id = sobject.get_id()
icon_wdg = ThumbWdg()
icon_wdg.set_name("snapshot")
icon_wdg.set_sobject(sobject)
div = HtmlElement.div()
div.set_style("background-color: #f0f0f0")
div.set_style("height: 100%")
checkbox = CheckboxWdg("download_files")
checkbox.set_option("value", "%s|%s" % (search_type, search_id))
div.add(checkbox)
if sobject.has_value("code"):
div.add("<b>%s</b>" % sobject.get_value("code"))
div.add("<br/>")
div.add(icon_wdg)
if sobject.has_value("code"):
div.add(sobject.get_value("description"))
td = table.add_cell(div)
td.add_style("height: 120px")
td.add_style("widget: 200px")
col += 1
outer_div.add(table)
my.add(outer_div)