本文整理汇总了Python中model.User.User.all方法的典型用法代码示例。如果您正苦于以下问题:Python User.all方法的具体用法?Python User.all怎么用?Python User.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.User.User
的用法示例。
在下文中一共展示了User.all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def post(self):
loggedIn= False
username=self.request.get('username')
password=self.request.get('password')
use = User.all().filter('username',username)
if use.count() == 1:
#user found
user = use.get()
if(user.password == password):
i = uuid.uuid1()
sess = Session(user=user.username,sessId=str(i))
sess.put()
self.session['sessId']=str(i)
loggedIn = True
template_params={'loggedIn':loggedIn,
'user': user.username}
render_template(self,'login.html',template_params)
else:
#no user found/something went wrong
loginError = True
template_params={
'loggedIn': loggedIn,
'loginError': loginError,
}
render_template(self,'login.html',template_params)
else:
#no user found/something went wrong
loginError = True
template_params={
'loggedIn': loggedIn,
'loginError': loginError,
}
render_template(self,'login.html',template_params)
示例2: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def post(self):
loggedIn= False
username=self.request.headers.get('Username')
password=self.request.headers.get('Password')
print("username="+username)
print("password="+password)
use = User.all().filter('username',username)
if use.count() == 1:
#user found
user = use.get()
if(user.password == password):
print("match")
i = uuid.uuid1()
sess = Session(user=user.username,sessId=str(i))
sess.put()
self.response.headers['Content-Type'] = 'application/json'
obj = {
'sessKey':str(i)
}
self.response.out.write(json.dumps(obj))
else:
#no user found/something went wrong
print("badpass")
else:
print("badname")
示例3: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def post(self):
loggedIn= True
username=self.request.get('username')
password=self.request.get('password')
android=self.request.get('android')
use = User.all().filter('username',username)
self.session.delete(username)
示例4: getuser
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def getuser(self):
if self.session.get('sessId'):
i = str(self.session.get('sessId'))
sess = Session.all().filter('sessId',i).get()
user = User.all().filter('username',sess.user).get()
return user
else:
return None
示例5: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def post(self):
loggedIn= False
username=self.request.get('username')
password=self.request.get('password')
android=self.request.get('android')
use = User.all().filter('username',username)
if use.count() == 1:
#user found
user = use.get()
if(user.password == password):
i = uuid.uuid1()
sess = Session(user=user.username,sessId=str(i))
sess.put()
self.session['sessId']=str(i)
badPass = False
loggedIn = True
template_params={'loggedIn':loggedIn,
'user': user.username}
render_template(self,'login.html',template_params)
else:
#no user found/something went wrong
loginError = True
template_params={
'loggedIn': loggedIn,
'loginError': loginError,
}
render_template(self,'login.html',template_params)
if android is not None and (android)==1:
if(badPass):
self.response.write("FAIL-BADPASS")
if(loginError):
self.response.write("FAIL-LOGINERROR")
else:
self.response.write("OK")
else:
self.redirect("/")
else:
if android is not None and (android)==1:
self.response.write("FAIL-BADNAME")
else:
#no user found/something went wrong
loginError = True
template_params={
'loggedIn': loggedIn,
'loginError': loginError,
}
render_template(self,'login.html',template_params)
示例6: get
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def get(self,sessId):
sess = Session.all().filter('sessId',sessId).get()
if sess is not None:
user = User.all().filter('username',sess.user).get()
print("user" + user.username)
if(user is not None):
jirgas = Jirga.get(user.jirgas)
result = []
self.response.headers['Content-Type'] = 'application/json'
for jirga in jirgas:
obj2 = {
'name': jirga.title,
'key': jirga.jirgaId,
}
result.append(obj2)
print(jirga.title)
self.response.out.write(json.dumps(result))
else:
self.response.write("FAIL - not logged in")
示例7: post
# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
def post(self):
success = False
template_params={}
username=self.request.get('username')
password=self.request.get('password')
android=self.request.get('android')
use = User.all().filter('username',username)
if use.count() == 0:
#no collisions
nameTaken = False
if (password is not None) and (password != ""):
#valid password
badPass = False
#create user account
usernew = User(username=username,password=password)
usernew.put()
success=True
template_params={'success':success}
else:
#invalid password
badPass = True
template_params={'success':success,'badPass':badPass}
if android is not None and (android)==1:
if(badPass):
self.response.write("FAIL-BADPASS")
else:
self.response.write("OK")
else:
render_template(self,'createUser.html',template_params)
else:
if android is not None and (android)==1:
self.response.write("FAIL-BADNAME")
else:
#username taken
nameTaken = True
template_params={'success':success,'nameTaken':nameTaken}
render_template(self,'createUser.html',template_params)