我試圖在視圖中使用is_authenticated()
,但得到錯誤'TypeError:'bool'對象不可調用。爲什麼我得到這個錯誤,我該如何解決?is_authenticated()引發TypeError TypeError:'bool'對象不可調用
@auth.before_app_request
def before_request():
if current_user.is_authenticated() \
and not current_user.confirmed \
and request.endpoint[:5] != 'auth.' \
and request.endpoint != 'static':
return redirect(url_for('auth.unconfirmed'))
刪除括號 – hsfzxjy
刪除'()'。 –
感謝您的幫助! – Gaoyang