本文整理汇总了Python中pyasm.biz.Project.extract_base_search_type方法的典型用法代码示例。如果您正苦于以下问题:Python Project.extract_base_search_type方法的具体用法?Python Project.extract_base_search_type怎么用?Python Project.extract_base_search_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Project
的用法示例。
在下文中一共展示了Project.extract_base_search_type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import extract_base_search_type [as 别名]
def init(my):
my.prefix = my.kwargs.get('prefix')
if not my.prefix:
my.prefix = 'simple_search'
my.content = None
my.top = DivWdg()
my.prefix = 'simple'
my.search_type = my.kwargs.get("search_type")
# this is needed for get_config() to search properly
my.base_search_type = Project.extract_base_search_type(my.search_type)
示例2: init
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import extract_base_search_type [as 别名]
def init(self):
self.prefix = self.kwargs.get('prefix')
if not self.prefix:
self.prefix = 'simple_search'
self.content = None
self.prefix = 'simple'
self.search_type = self.kwargs.get("search_type")
# this is needed for get_config() to search properly
self.base_search_type = Project.extract_base_search_type(self.search_type)
self.column_choice = None
示例3: init
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import extract_base_search_type [as 别名]
def init(my):
my.prefix = my.kwargs.get("prefix")
if not my.prefix:
my.prefix = "simple_search"
my.content = None
my.top = DivWdg()
my.prefix = "simple"
my.search_type = my.kwargs.get("search_type")
# this is needed for get_config() to search properly
my.base_search_type = Project.extract_base_search_type(my.search_type)
my.column_choice = None
示例4: get_display
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import extract_base_search_type [as 别名]
def get_display(my):
message = my.sobjects[0]
if message.get_search_type() == 'sthpw/message':
message_code = message.get_value("code")
else:
message_code = message.get_value("message_code")
category = message.get_value("category")
table = Table()
table.add_row()
td = table.add_cell()
subscription = my.kwargs.get('subscription')
td.add( my.get_preview_wdg(subscription, category=category, message_code=message_code ))
message_value = message.get_value("message")
message_login = message.get_value("login")
#TODO: implement short_format even for closing html tags properly while truncating
short_format = my.kwargs.get('short_format') in ['true', True]
if message_value.startswith('{') and message_value.endswith('}'):
#message_value = message_value.replace(r"\\", "\\");
message_value = jsonloads(message_value)
# that doesn't support delete
update_data = message_value.get("update_data")
sobject_data = message_value.get("sobject")
sobject_code = sobject_data.get('code')
if category == "sobject":
search_type = message_value.get("search_type")
if search_type == "sthpw/note":
description = "<b>Note added:</b><br/>%s" % update_data.get("note")
elif search_type == "sthpw/task":
description = "<b>Task modified:</b><br/>%s" % update_data.get("process")
elif search_type == "sthpw/snapshot":
sobject = message_value.get("sobject")
description = "<b>Files checked in:</b><br/>%s" % sobject.get("process")
else:
display = []
if update_data:
for key, val in update_data.items():
display.append('%s – %s'%(key, val))
else:
if message_value.get('mode') == 'retire':
display.append('Retired')
base_search_type = Project.extract_base_search_type(search_type)
description = DivWdg()
title = DivWdg("<b>%s</b> - %s modified by %s:"%(base_search_type, sobject_code, message_login))
title.add_style('margin-bottom: 6px')
content = DivWdg()
content.add_style('padding-left: 2px')
content.add('<br>'.join(display))
description.add(title)
description.add(content)
else:
description = message_value.get("description")
else:
if category == "chat":
login = message.get("login")
timestamp = message.get("timestamp")
message_value = message.get("message")
message_value = message_value.replace("\n", "<br/>")
description = '''
<b>%s</b><br/>
%s
''' % (login, message_value)
else:
description = message_value
div = DivWdg()
div.add(description)
table.add_cell(div)
return table
示例5: get_display
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import extract_base_search_type [as 别名]
def get_display(my):
# my.sobjects is preferred, otherwise use
# search_key.
search_key = my.kwargs.get('search_key')
if not my.sobjects and search_key:
message = Search.get_by_search_key(search_key)
elif my.sobjects:
message = my.sobjects[0]
if message.get_search_type() == 'sthpw/message':
message_code = message.get_value("code")
else:
message_code = message.get_value("message_code")
category = message.get_value("category")
table = Table()
table.add_row()
td = table.add_cell()
subscription = my.kwargs.get('subscription')
show_preview = my.kwargs.get('show_preview')
if show_preview in ['',None]:
show_preview = True
show_preview_category_list = ['sobject','chat']
if (category in show_preview_category_list and show_preview not in ['False','false',False]) or show_preview in ["True" ,"true",True]:
td.add( my.get_preview_wdg(subscription, category=category, message_code=message_code ))
message_value = message.get_value("message")
message_login = message.get_value("login")
#TODO: implement short_format even for closing html tags properly while truncating
short_format = my.kwargs.get('short_format') in ['true', True]
if message_value.startswith('{') and message_value.endswith('}'):
#message_value = message_value.replace(r"\\", "\\");
message_value = jsonloads(message_value)
# that doesn't support delete
if category == "sobject":
update_data = message_value.get("update_data")
sobject_data = message_value.get("sobject")
sobject_code = sobject_data.get('code')
search_type = message_value.get("search_type")
if search_type == "sthpw/note":
description = "<b>Note added:</b><br/>%s" % update_data.get("note")
elif search_type == "sthpw/task":
description = "<b>Task modified:</b><br/>%s" % update_data.get("process")
elif search_type == "sthpw/snapshot":
sobject = message_value.get("sobject")
description = "<b>Files checked in:</b><br/>%s" % sobject.get("process")
else:
display = []
if update_data:
for key, val in update_data.items():
display.append('%s – %s'%(key, val))
else:
if message_value.get('mode') == 'retire':
display.append('Retired')
base_search_type = Project.extract_base_search_type(search_type)
description = DivWdg()
title = DivWdg("<b>%s</b> - %s modified by %s:"%(base_search_type, sobject_code, message_login))
title.add_style('margin-bottom: 6px')
content = DivWdg()
content.add_style('padding-left: 2px')
content.add('<br>'.join(display))
description.add(title)
description.add(content)
elif category == 'progress':
description = DivWdg()
message = message_value.get('message')
message_div = DivWdg()
message_div.add(message)
description.add(message_div)
percent = message_value.get('progress')
if not percent:
percent = 0.0
progress = HtmlElement('progress')
progress.add_attr('value', percent)
progress.add_attr('max', '100')
progress.add_styles('''width: 280px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.75) inset''')
progress_size = my.kwargs.get("progress_size")
if progress_size == "large":
progress.add_styles("height: 16px; margin-top: 9px;")
else:
progress.add_styles("height: 5px; margin-top: 4px;")
description.add(progress)
else:
message = message_value.get('message')
if message:
description = message
#.........这里部分代码省略.........