本文整理匯總了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")