'bool' object is not callable
@app.route('/login', methods=['GET', 'POST'])
@oid.loginhandler
def login():
# 认证用户
if g.user is not None and g.user.is_authenticated():
return redirect(url_for('index'))
form = LoginForm()
if form.validate_on_submit():
session['remember_me'] = form.remember_me.data
# The ask_for and ask_for_optional`parameter can be a set of values to be asked from the openid provider
return oid.try_login(form.openid.data, ask_for=['nickname', 'email'])
return render_template('login.html', title='Sign In', form=form, )
Just use it as a predicate, instead of calling it.布尔类型不能被调用,直接作为判定就行
if g.user is not None and g.user.is_authenticated():
此行代码修改为if g.user is not None and g.user.is_authenticated: