本文整理汇总了Python中user.User.getuser方法的典型用法代码示例。如果您正苦于以下问题:Python User.getuser方法的具体用法?Python User.getuser怎么用?Python User.getuser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.getuser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validate
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import getuser [as 别名]
def validate(self):
"""checks the validity of the form data and also compares
it with the password from database to make sure that
its valid"""
if not Form.validate(self):
return False
user = User.getuser(self.email.data.lower())
if user and user.checkpassword(self.password.data):
return True
else:
flash("Invalid e-mail or password")
return False
示例2: login
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import getuser [as 别名]
def login():
"""" handles all user login handling """
app.logger.debug('Inside Login form')
login_form = LoginForm(request.form)
if login_form.validate():
app.logger.debug('Post method received and form validated')
login_user(User.getuser(login_form.email.data))
nexturl = request.args.get('next')
return redirect(nexturl or '/')
flash_errors(login_form)
return redirect('/')
示例3: show_user
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import getuser [as 别名]
def show_user(id=None):
u = User()
fname, lname, login = list(u.getuser(id))[0]
return render_template('index.html', fname=fname, lname=lname, login=login)
示例4: user_loader
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import getuser [as 别名]
def user_loader(user_id):
""" Loads ther user when needed for Login """
app.logger.debug("Loading user")
return User.getuser(user_id)