本文整理汇总了Python中models.Exercise.flowchart方法的典型用法代码示例。如果您正苦于以下问题:Python Exercise.flowchart方法的具体用法?Python Exercise.flowchart怎么用?Python Exercise.flowchart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Exercise
的用法示例。
在下文中一共展示了Exercise.flowchart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Exercise [as 别名]
# 或者: from models.Exercise import flowchart [as 别名]
def post(self):
upload_files = self.get_uploads()
used_methods = list()
for method in test_methods:
if self.request.get(method):
used_methods.append(method)
inputs = list()
for i in string.replace(self.request.get('test_input'), '\r', '').split(';'):
inputs.append(db.Text(i))
outputs = list()
for o in string.replace(self.request.get('output'), '\r', '').split(';'):
outputs.append(db.Text(o))
if len(inputs) != len(outputs):
self.write("Error: Number of inputs did not match number of outputs.")
else:
keywords = string.replace(self.request.get('keywords'), '\r', '').split(';')
checker = ExerciseChecker( test_methods=used_methods,
inputs=inputs,
outputs=outputs,
keywords=keywords)
checker.put()
start_code=string.replace(self.request.get('start_code'), '\r', '')
description = self.request.get('description')
description = string.replace(description, '\r', '')
description = string.replace(description, '\n', '<br>')
exercise = Exercise(name=self.request.get('name'),
url=self.request.get('url'),
description=description,
start_code=start_code,
checker=checker)
if len(upload_files):
exercise.flowchart = upload_files[0].key()
exercise.put()
time.sleep(5)
self.redirect('/exercises/'+exercise.url)