本文整理汇总了Python中tactic_client_lib.TacticServerStub.checkout方法的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub.checkout方法的具体用法?Python TacticServerStub.checkout怎么用?Python TacticServerStub.checkout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic_client_lib.TacticServerStub
的用法示例。
在下文中一共展示了TacticServerStub.checkout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import checkout [as 别名]
def main(args):
search_type = args[0]
code = args[1]
if len(args) == 2:
context = "publish"
to_dir = "."
elif len(args) == 3:
context = "publish"
to_dir = args[2]
else:
context = args[2]
to_dir = args[3]
server = TacticServerStub()
# do the actual work
server.start("Checked out file/s to [%s]" % to_dir)
try:
# query all of the search_types to simplify argument
if search_type.find("/") == -1:
columns = ["search_type"]
results = server.query("sthpw/search_object", columns=columns)
for result in results:
test = result.get("search_type")
if test.endswith("/%s" % search_type):
search_type = test
break
else:
raise Exception("Search type [%s] not found" % search_type)
search_key = server.build_search_key(search_type, code)
# checkin the uploaded file
version = -1
result = server.checkout(search_key, context, version=version, to_dir=to_dir)
print result
except:
server.abort()
raise
else:
server.finish()