【问题标题】:How to set a value in session in cherrypy and how to get that value?如何在cherrypy的会话中设置一个值以及如何获取该值?
【发布时间】:2013-10-08 13:27:23
【问题描述】:

我通过导入cherrypy创建了如下会话

cherrypy.session['otp_status']=1

但是当我尝试按以下方式检索它时

otp_status=cherrypy.session['otp_status']

显示

KeyError: 'otp_status'

如何从会话中获取价值?

【问题讨论】:

  • cherrypy.session['otp_status']==1 是比较,不是分配。
  • 你确定你没有输入cherrypy.session['otp_status'] = 1吗?
  • @Cthulhu 我已经更新了这个问题。我正在尝试从另一个 python 文件中检索会话值。并且 KeyError: 'otp_status' 发生在那里。

标签: python session openerp cherrypy


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2014-07-13
  • 2017-04-19
  • 2013-06-27
  • 1970-01-01
  • 2014-05-21
  • 2012-01-22
  • 2010-10-17
  • 1970-01-01
相关资源
最近更新 更多