flask-login

Flask-Login raises TypeError: 'bool' object is not callable when trying to override is_active property

假装没事ソ 提交于 2019-11-26 08:51:50
问题 I want to modify is_active in Flask-Login so that users are not always active. The default always returns True , but I changed it to return the value of the banned column. Based on the docs, is_active should be a property. However, the internal Flask-Login code raises: TypeError: \'bool\' object is not callable When trying to use is_active . How do I correctly use is_active to deactivate some users? class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) banned = db

Flask view raises TypeError: 'bool' object is not callable

北慕城南 提交于 2019-11-25 21:46:54
问题 I am trying to debug a view in my Flask app that is return a 500 status with the error TypeError: \'bool\' object is not callable in the traceback. The view calls login_user from Flask-Login then returns True to indicate that the login was successful. I have debugged until app_iter = app(environ, start_response) and the app is now a boolean with the value True rather than the Flask app object. Traceback (most recent call last): File \"D:\\Python27\\lib\\site-packages\\flask\\app.py\", line