1

我在基于 Flask 的应用程序中使用 Beaker 和 Memcached 进行会话管理,但是当用户会话处于活动状态时,有时也会在注销用户时收到“AttributeError:'Session' object has no attribute'permanent'”。请参阅下面的错误

  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/flask/templating.py", line 126, in render_template
    ctx.app.update_template_context(context)
  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/flask/app.py", line 716, in update_template_context
    context.update(func())
  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/flask_login.py", line 826, in _user_context_processor
    return dict(current_user=_get_user())
  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/flask_login.py", line 795, in _get_user
    current_app.login_manager._load_user()
  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/flask_login.py", line 340, in _load_user
    deleted = self._session_protection()
  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/flask_login.py", line 383, in _session_protection
    if mode == 'basic' or sess.permanent:
  File "/home/hirealchemy/hirealchemy_v2/local/lib/python2.7/site-packages/beaker/session.py", line 663, in __getattr__
    return getattr(self._session(), attr)
AttributeError: 'Session' object has no attribute 'permanent'
4

0 回答 0