本文整理汇总了Python中pyasm.search.SearchKey.get_by_sobjects方法的典型用法代码示例。如果您正苦于以下问题:Python SearchKey.get_by_sobjects方法的具体用法?Python SearchKey.get_by_sobjects怎么用?Python SearchKey.get_by_sobjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.SearchKey
的用法示例。
在下文中一共展示了SearchKey.get_by_sobjects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_cache
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import get_by_sobjects [as 别名]
def init_cache(self):
'''initialize the cache'''
self.mtime = datetime.datetime.now()
keys = self.caches.keys()
self.caches = {}
search = Search(self.search_type)
search.set_show_retired(True)
self.sobjects = search.get_sobjects()
# build a search_key cache
search_key_cache = {}
search_keys = SearchKey.get_by_sobjects(self.sobjects)
for search_key, sobject in zip(search_keys, self.sobjects):
search_key_cache[search_key] = sobject
self.caches['search_key'] = search_key_cache
code_cache = {}
for sobject in self.sobjects:
code = sobject.get_code()
code_cache[code] = sobject
self.caches['code'] = code_cache
for key in keys:
if key in ['search_key', 'code']:
continue
self.build_cache_by_column(key)
示例2: check
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import get_by_sobjects [as 别名]
def check(my):
if my.mode == 'export_matched':
from tactic.ui.panel import TableLayoutWdg
table = TableLayoutWdg(search_type=my.search_type, view=my.view,\
show_search_limit='false', search_limit=-1, search_view=my.search_view,\
search_class=my.search_class, simple_search_view=my.simple_search_view, init_load_num=-1)
table.handle_search()
search_objs = table.sobjects
my.selected_search_keys = SearchKey.get_by_sobjects(search_objs, use_id=True)
return True
for sk in my.input_search_keys:
st = SearchKey.extract_search_type(sk)
if st not in my.search_type_list:
my.search_type_list.append(st)
id = SearchKey.extract_id(sk)
if id == '-1':
continue
my.selected_search_keys.append(sk)
if len(my.search_type_list) > 1:
my.check_passed = False
my.error_msg = 'More than 1 search type is selected. Please keep the selection to one type only.'
return False
if not my.search_type_list and my.mode == 'export_selected':
my.check_passed = False
my.error_msg = 'Search type cannot be identified. Please select a valid item.'
return False
return True
示例3: check
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import get_by_sobjects [as 别名]
def check(self):
if self.mode == 'matched':
from tactic.ui.panel import FastTableLayoutWdg
table = FastTableLayoutWdg(search_type=self.search_type, view=self.view,\
show_search_limit='false', search_limit=-1, search_view=self.search_view, \
simple_search_view=self.simple_search_view, search_class=self.search_class)
table.handle_search()
search_objs = table.sobjects
self.search_key_list = SearchKey.get_by_sobjects(search_objs, use_id=True)
return True
else:
self.search_key_list = self.kwargs.get('search_key_list')
if self.search_key_list and isinstance(self.search_key_list, basestring):
self.search_key_list = eval(self.search_key_list)