我有烧瓶+wtforms 应用程序。我可以在 login() 用户对象中看到存储为
if user:
if user.verify_password(form.password.data):
flash('You have been logged in')
user.logins += 1
db.session.add(History(user.uid))
db.session.commit()
session['user'] = user
现在我想检索用户
if 'user' in session:
User=session.get('user')
print User.nickname ###<< how to retrieve specific object member?
它失败并显示如下消息:
Instance <User at 0x8e5a64c> is not bound to a Session; attribute refresh operation cannot proceed