Friday, 15 January 2010

python - "TypeError: 'bool' object is not callable" in flask -



python - "TypeError: 'bool' object is not callable" in flask -

i have is_active = db.column(db.boolean(), nullable=false) field in user model in flask app when loging in, error typeerror: 'bool' object not callable

traceback

. . . file "/home/environments/flask0101/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request homecoming self.view_functions[rule.endpoint](**req.view_args) file "/home/flask/myapp/app/auth/views.py", line 15, in login login_user(user) file "/home/environments/flask0101/lib/python2.7/site-packages/flask_login.py", line 675, in login_user if not forcefulness , not user.is_active(): typeerror: 'bool' object not callable

what issue?

is_active bool object.

>>> is_active = true >>> is_active() traceback (most recent phone call last): file "<stdin>", line 1, in <module> typeerror: 'bool' object not callable

just utilize predicate, instead of calling it:

if not forcefulness , not user.is_active: ...

python flask flask-sqlalchemy flask-login

No comments:

Post a Comment