Athena LivePage的页面刷新异常和解决方法
来源:互联网 发布:windows打开keynote 编辑:程序博客网 时间:2024/05/20 18:53
Athena的LivePage对象很好用,但是在刷新的时候,会有一个异常:
exceptions.AssertionError: Cannot render a LivePage more than once
官方说法是:
LivePage instances maintain server-side state that corresponds to the connection to the browser. Because of this, each LivePage instance can only be used to serve a single client. When you serve LivePages?, make sure that you create a new instance for each render pass.
LivePage对象维护着服务端的状态,这个状态对应着从浏览器过来的连接。因此,每个LivePage对象只能用来为一个客户端服务。当你使用LivePage,一定要保证在render的时候,传回一个新对象。
每次使用LivePage,总要创建新实例。
------------------------------------July 19 更新----------------------------------
我们有一个Index的页面,是LivePage, 想让用户访问的第一个页面就是这个。
那在site对象建立的时候,我们就需要一个实例:
site = appserver.NevowSite(Index())
这样是不能刷新的,会有AssertionError错误。
那就这样,我们写一个RootPage, 在这个RootPage中,不论用户访问什么,总返回一个新的Index:
class RootPage(????):
'''
always return a new Index
'''
def child_(self, ctx):
return Index()
然后:
site = appserver.NevowSite(RootPage())
这样不就行了嘛。
我打"?"的地方是有问题的。
如果RootPage从rend.Page继承,Athena所有的js框架和自己的js文件(模板中,render "liveglue"生成)都不能被正确的加载。
要想这些js被加载,RootPage必须继承LivePage, 这样,就陷入死循环了。
具体解决的办法是:
class RootPage(Index):
'''
always return a new Index
'''
def child_(self, ctx):
return Index()
这样就保证不会出现刷新问题。
- Athena LivePage的页面刷新异常和解决方法
- 刷新页面出现重试和取消解决方法
- Athena Framework实例的安装
- AJAX的后退页面刷新问题的解决方法(1)
- 刷新页面后密码框“清空”的解决方法
- 关于form页面刷新重复提交的解决方法
- 页面按F5刷新,避免表单重复提交的解决方法
- 页面刷新后 Ueditor 无法实例化的解决方法
- Webstrom 20163.3刷新页面一直提示未授权的解决方法
- 区分页面的刷新和关闭事件
- javascript实现页面的重新加载和页面的刷新
- js中页面刷新和页面跳转的方法总结
- 浏览器页面数据保存后不显示,需要重新刷新页面才能正常显示的解决方法
- window.open()关闭子页面父页面不刷新的解决方法
- getOutputStream()异常的原因和解决方法
- 我遇到的JAVA异常和解决方法
- maven遇到的异常和错误解决方法
- plsql连接linux64oracle11g的异常和解决方法
- 裸设备访问权限误更改导致数据库异常
- Oracle 10g新特性
- Asp.net中服务端控件事件是如何触发的
- 鼠标拾取原理介绍
- PowerDesigner Name/Code自动调整 中文注释
- Athena LivePage的页面刷新异常和解决方法
- PowerDesigner 同时显示name code的替代方案
- C++ 简单实现委托
- 教你快速成长为一名厉害的网页设计师
- 转一朋友的离职信
- C#读写XML
- 摩托罗拉手机前途系于Android手机
- insertAdjacentElement方法
- 抽象类 & 接口& 虚函数&纯虚函数&非虚函数