本文整理汇总了Python中pyasm.search.SearchKey.build_search_key方法的典型用法代码示例。如果您正苦于以下问题:Python SearchKey.build_search_key方法的具体用法?Python SearchKey.build_search_key怎么用?Python SearchKey.build_search_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.SearchKey
的用法示例。
在下文中一共展示了SearchKey.build_search_key方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_td
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import build_search_key [as 别名]
def handle_td(my, td):
super(LoginTableElementWdg, my).handle_td(td)
task = my.get_current_sobject()
if task:
search_type = task.get_value('search_type')
search_id = task.get_value('search_id')
if not search_type or not search_id:
return
search_key = SearchKey.build_search_key(search_type, search_id, column='id')
from pyasm.common import SObjectSecurityException
try:
parent = Search.get_by_search_key(search_key)
pipeline = Pipeline.get_by_sobject(parent)
if pipeline:
attrs = pipeline.get_process_attrs(task.get_value('process'))
td.add_attr('spt_pipeline_code', attrs.get('%s_login_group'%my.get_name()))
except SObjectSecurityException, e:
pass
except SearchException, e:
if e.__str__().find('not registered') != -1:
pass
elif e.__str__().find('does not exist for database') != -1:
pass
elif e.__str__().find('Cannot find project') != -1:
pass
else:
raise
示例2: get_ref_obj
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import build_search_key [as 别名]
def get_ref_obj(self, sobject):
search_type = sobject.get_value("search_type")
search_code = sobject.get_value("search_code", no_exception=True)
if not search_code:
search_id = sobject.get_value("search_code")
else:
search_id = None
key = SearchKey.build_search_key(search_type, search_code)
ref_sobject = self.ref_sobj_dict.get(str(key))
if not ref_sobject:
try:
if search_code:
ref_sobject = Search.get_by_code(search_type, search_code)
else:
ref_sobject = Search.get_by_id(search_type, search_id)
if not ref_sobject:
return None
except SearchException as e:
print e.__str__()
return None
return ref_sobject
示例3: get_bottom_wdg
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import build_search_key [as 别名]
def get_bottom_wdg(my):
if my.get_option('mode') =='input':
return
web = WebContainer.get_web()
if web.get_selected_app() not in ['XSI','Maya']:
return
div = DivWdg(css='spt_outdated_ref')
refs = my.session.get_data().get_nodes("session/node/ref")
snap_codes = []
snap_contexts = []
sobjects = []
session_data_dict = {}
asset_codes = []
current_snapshots = []
node_names = []
session_versions = []
for ref in refs:
snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
node_name = Xml.get_attribute(ref, "name")
version = Xml.get_attribute(ref, "asset_snapshot_version")
asset_code = Xml.get_attribute(ref, "asset_code")
if snap_code in snap_codes:
continue
snap_codes.append(snap_code)
snap_contexts.append(Xml.get_attribute(ref, "asset_snapshot_context"))
asset_codes.append(asset_code)
session_data_dict[snap_code] = version, node_name
# must search one by one
warnings=[]
for idx, snap_code in enumerate(snap_codes):
snapshot = Snapshot.get_by_code(snap_code)
if not snapshot:
continue
search_type = snapshot.get_value('search_type')
search_id = snapshot.get_value('search_id')
sk = SearchKey.build_search_key(search_type, search_id, column='id')
current_snapshot = Snapshot.get_snapshot(search_type, search_id, context=snap_contexts[idx], version=0)
if not current_snapshot:
warnings.append("Current version for [%s] context [%s] not found" %(sk, snap_contexts[idx]))
continue
session_version, node_name = session_data_dict.get(snap_code)
if session_version and int(current_snapshot.get_version()) > int(session_version):
current_snapshots.append(current_snapshot)
sobjects.append(current_snapshot.get_sobject())
node_names.append(node_name)
session_versions.append(int(session_version))
title = DivWdg('Outdated References')
title.add_style('text-decoration','underline')
div.add(title)
# draw the nodes to be udpated
for idx, current_snap in enumerate(current_snapshots):
cb = CheckboxWdg(my.REF_CB_NAME)
cb.add_class('spt_ref')
cb.add_style('display: none')
sobj = sobjects[idx]
node_name = node_names[idx]
session_version = session_versions[idx]
snapshot = current_snap
cb_value = my.get_input_value(sobj, snapshot)
items = cb_value.split('|')
items[-1] = node_name
cb_value = '|'.join(items)
cb.set_option('value', cb_value)
div.add(cb)
div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
%(idx+1, node_name, session_version, snapshot.get_version()))
div.add(HtmlElement.br())
for warning in warnings:
div.add(SpanWdg(warning, css='warning'))
div.add(HtmlElement.br())
if current_snapshots:
# add the button
prefix = my.search_type
#input_name = '%s_%s' %(my.search_type, my.CB_NAME)
update_button = ProdIconButtonWdg("Update all references")
update_button.add_behavior({'type': "click_up",\
'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
cousins.each( function(x) {x.checked=true;}); py_replace_reference(bvr, '%s','%s')'''
% (prefix, my.REF_CB_NAME)})
div.add( SpanWdg(update_button, css='small'))
div.add(HtmlElement.br(2))
return div