Error: 'bool' object is not callable



  • There's this function:

    @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
        return oid.try_login(form.openid.data, ask_for=['nickname', 'email'])
    
    return render_template('login.html',
                           title='Sign In',
                           form=form,
                           providers=app.config['OPENID_PROVIDERS'])
    

    In line implementation

    if g.user is not None and g.user.is_authenticated():

    error

    TypeError: 'bool' object is not callable

    I don't know what this is about. ♪ ♪



  • Use it. g.user.is_authenticated (without brackets).




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2