文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>pylons 1.0 AttributeError: 'ContextObj' object has no attribute "xx

pylons 1.0 AttributeError: 'ContextObj' object has no attribute "xx

时间:2011-04-17  来源:Jerry.Kwan

将代码升级至pylons1.0,原本运行良好的程序报出:
AttributeError: 'ContextObj' object has no attribute 'tabs' 异常,经过查询资料得知是pylons1.0相比较0.97做了一些调整,pylons 1.0默认情况下tmpl_context将不再是AttribSafeContextObj,也就是说:访问不存在的属性将产生AttributeError异常,为使用attribute-safe tmpl_context,可以更改config/environment.py,增加config['pylons.strict_tmpl_context'] = False即可.
官方说法原文为:
By default, the tmpl_context (a.k.a ‘c’), is no longer a AttribSafeContextObj. This means accessing attributes that don’t exist will raise an AttributeError.
    To use the attribute-safe tmpl_context, add this line to the config/environment.py:
    config['pylons.strict_tmpl_context'] = False

详情请参阅 http://pylonshq.com/docs/en/1.0/upgrading/

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载