本文整理汇总了Python中user.models.User.query方法的典型用法代码示例。如果您正苦于以下问题:Python User.query方法的具体用法?Python User.query怎么用?Python User.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.models.User
的用法示例。
在下文中一共展示了User.query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_post
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import query [as 别名]
def user_post(self, *args):
pagename = args[0]
if args[0] is None:
pagename=""
exercise = Exercise.query().filter("url = ",pagename).get()
submission = self.request.get('code')
program = exercise.outside_code.format(submission)
action = self.request.get('action')
response = dict()
if action == 'check':
response = exercise.checker.checkWork(program, self.username)
if response['passed']:
user = User.query().filter('username = ', self.username).get()
if user and (not exercise.key() in user.exercises_completed):
user.exercises_completed.append(exercise.key())
user.put()
elif action == 'test':
message = ''
logging.info(self.request.get('input'))
response = exercise.checker.submit(program, self.username, self.request.get('input'))
if (response['error'] != "OK" or
int(response['result']) != 15 or
response['output'] is None):
message = response['error_message']
response['message'] = message
self.write_json(response);
示例2: len
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import query [as 别名]
import os
import pprint
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.api import urlfetch
from google.appengine.ext import db
pprint.pprint(os.environ.copy())
from user.models import User
#pprint.pprint(dir(User))
users = User.query().fetch()
pprint.pprint('Users found: %i' % len(users))
for user in users:
if user.password is None:
user.password = 'passwd'
user.put()