"TypeError: object" bool "cannot be called" in the bulb

I have a is_active = db.Column(db.Boolean(), nullable=False)field in the user model in mine flask appnow that when I log in I get an errorTypeError: 'bool' object is not callable

Traceback

.
.
.
File "/home/environments/flask0101/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return 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 force and not user.is_active():
TypeError: 'bool' object is not callable

What is the problem?

+4
source share
3 answers

is_active - bool object.

>>> is_active = True
>>> is_active()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'bool' object is not callable

Just use it as a predicate, and not call it:

if not force and not user.is_active:
    ...
+6
source

Flask-Login 0.3 , is_active, is_anonymous is_authenticated . , , is_active , . , , @property.

+6

, , 0,3. . !

, , v0.3.2, , Flask Security. 0.2.11.

pip install flask_login==0.2.11
-1

All Articles