本文整理汇总了Python中model.testfile.TestFile.update方法的典型用法代码示例。如果您正苦于以下问题:Python TestFile.update方法的具体用法?Python TestFile.update怎么用?Python TestFile.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.testfile.TestFile
的用法示例。
在下文中一共展示了TestFile.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model.testfile import TestFile [as 别名]
# 或者: from model.testfile.TestFile import update [as 别名]
def post(self):
file_params = self.request.POST.getall(PARAM_FILE)
if not file_params:
self.response.out.write("FAIL: missing upload file field.")
return
builder = self.request.get(PARAM_BUILDER)
if not builder:
self.response.out.write("FAIL: missing builder parameter.")
return
master = self.request.get(PARAM_MASTER)
test_type = self.request.get(PARAM_TEST_TYPE)
incremental = self.request.get(PARAM_INCREMENTAL)
logging.debug(
"Processing upload request, master: %s, builder: %s, test_type: %s.",
master, builder, test_type)
# There are two possible types of each file_params in the request:
# one file item or a list of file items.
# Normalize file_params to a file item list.
files = []
logging.debug("test: %s, type:%s", file_params, type(file_params))
for item in file_params:
if not isinstance(item, list) and not isinstance(item, tuple):
item = [item]
files.extend(item)
errors = []
for file in files:
filename = file.filename.lower()
if ((incremental and filename == "results.json") or
(filename == "incremental_results.json")):
# Merge incremental json results.
update_succeeded = JsonResults.update(master, builder, test_type, file.value)
else:
update_succeeded = TestFile.update(
master, builder, test_type, file.filename, file.value)
if not update_succeeded:
errors.append(
"Upload failed, master: %s, builder: %s, test_type: %s, name: %s." %
(master, builder, test_type, file.filename))
if errors:
messages = "FAIL: " + "; ".join(errors)
logging.warning(messages)
self.response.set_status(500, messages)
self.response.out.write("FAIL")
else:
self.response.set_status(200)
self.response.out.write("OK")