本文整理汇总了Python中pyasm.biz.Snapshot.get_current_by_sobject方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.get_current_by_sobject方法的具体用法?Python Snapshot.get_current_by_sobject怎么用?Python Snapshot.get_current_by_sobject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Snapshot
的用法示例。
在下文中一共展示了Snapshot.get_current_by_sobject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_current_by_sobject [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
snapshots = []
if isinstance(sobject, Layer):
# for layer renders, we try to get all render sobjects
renders = Render.get_all_by_sobject(sobject)
if renders:
snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
else: # for object that has direct snapshots like plates
snapshot = Snapshot.get_current_by_sobject(sobject)
if snapshot:
snapshots.append(snapshot)
if not snapshots:
return "<i>- no files -</i>"
div = DivWdg()
for snapshot in snapshots:
file_types = snapshot.get_all_file_types()
table = Table(css='embed')
for file_type in file_types:
table.add_row()
table.add_cell( self.get_open_wdg(snapshot, file_type) )
dir = snapshot.get_client_lib_dir(file_type=file_type)
table.add_cell( "%s: <i>%s</i>" % (file_type, dir) )
div.add(table)
return div
示例2: copy_sobject
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_current_by_sobject [as 别名]
def copy_sobject(my, sobject, dst_search_type, context=None, checkin_mode='inplace'):
new_sobject = SearchType.create(dst_search_type)
search_type = SearchType.get(dst_search_type)
columns = SearchType.get_columns(dst_search_type)
data = sobject.get_data()
for name, value in data.items():
if name in ['id','pipeline_code']:
continue
if name not in columns:
continue
if not value:
continue
if name == "code":
value = Common.get_next_sobject_code(sobject, 'code')
if not value:
continue
new_sobject.set_value(name, value)
if SearchType.column_exists(dst_search_type, "project_code"):
project_code = Project.get_project_code()
new_sobject.set_value("project_code", project_code)
new_sobject.commit()
# get all of the current snapshots and file paths associated
if not context:
snapshots = Snapshot.get_all_current_by_sobject(sobject)
else:
snapshots = [Snapshot.get_current_by_sobject(sobject, context)]
if not snapshots:
return
msgs = []
for snapshot in snapshots:
#file_paths = snapshot.get_all_lib_paths()
file_paths_dict = snapshot.get_all_paths_dict()
file_types = file_paths_dict.keys()
if not file_types:
continue
# make sure the paths match the file_types
file_paths = [file_paths_dict.get(x)[0] for x in file_types]
mode = checkin_mode
# checkin the files (inplace)
try:
context = snapshot.get_value('context')
checkin = FileCheckin(new_sobject, context=context, file_paths=file_paths, file_types=file_types, mode=mode)
checkin.execute()
#print "done: ", context, new_sobject.get_related_sobjects("sthpw/snapshot")
except CheckinException, e:
msgs.append('Post-process Check-in Error for %s: %s ' %(context, e.__str__()))
示例3: init
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_current_by_sobject [as 别名]
def init(my):
search_type = "prod/shot"
widget = Widget()
search = Search(search_type)
div = DivWdg(css="filter_box")
filter = SequenceFilterWdg()
div.add(filter)
#context_filter = ContextFilterWdg(label="Context: ", search_type=)
#context_filter.set_search_type(search_type)
#div.add(context_filter)
context_wdg = TextWdg("context")
context_wdg.set_persistence()
span = SpanWdg(css="med")
span.add("Context: ")
span.add(context_wdg)
div.add(span)
my.context = context_wdg.get_value()
if not my.context:
my.context = None
mode = "latest"
filter.alter_search(search)
sobjects = search.get_sobjects()
widget.add(div)
table = Table(css="table")
table.add_style("width: 100%")
for sobject in sobjects:
table.add_row()
thumb = ThumbWdg()
thumb.set_sobject(sobject)
table.add_cell(thumb)
table.add_cell( sobject.get_code() )
td = table.add_cell( WikiUtil().convert(sobject.get_value("description") ))
td.add_style("width: 300px")
if mode == "latest":
snapshot = Snapshot.get_latest_by_sobject(sobject, my.context)
else:
snapshot = Snapshot.get_current_by_sobject(sobject, my.context)
if not snapshot:
table.add_cell("<i>No snapshot found</i>")
continue
dependency = DependencyWdg()
dependency.set_show_title(False)
dependency.set_sobject(snapshot)
table.add_cell(dependency)
widget.add(table)
my.add(widget)