本文整理汇总了Python中models.Submission.score方法的典型用法代码示例。如果您正苦于以下问题:Python Submission.score方法的具体用法?Python Submission.score怎么用?Python Submission.score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Submission
的用法示例。
在下文中一共展示了Submission.score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Submission [as 别名]
# 或者: from models.Submission import score [as 别名]
def post(self):
format = self.request.get('format', 'json').lower()
id = self.request.get('level_id', None)
if id is None:
res = {"response": {"error": "no level id with submission"}}
else:
level = Level.get_by_id(long(id))
user_name = self.request.get('user')
user = User.all().filter('name =', user_name).get()
if user is None:
user = User(name = user_name)
user.put()
score = self.request.get('score', 0)
words_found = self.request.get('words_found').split(",")
submission = Submission()
submission.user = user
submission.level = level
submission.score = score
submission.words_found = words_found
submission.time = datetime.datetime.now()
submission.put()
res = {"response": {"status" : "OK"}}
if format == "json":
self.response.out.write(simplejson.dumps(res))
elif format == "xml":
self.response.out.write(dict2xml(res).to_string())