用于extjs 3的zope3 ext.direct-服务器端堆栈。

falkolab.ext3.direct的Python项目详细描述


zope3 ext.direct-extjs 3的服务器端堆栈。

如何使用它?

让我们注册api和视图:

>>> from zope.configuration import xmlconfig
>>> context = xmlconfig.string("""
... <configure
...     xmlns="http://namespaces.zope.org/zope"
...     xmlns:extdirect="http://namespaces.zope.org/extdirect"
...     >
...   <include package="falkolab.ext3.direct" file="meta.zcml" />
...
...   <extdirect:api
...       for="zope.app.folder.interfaces.IFolder"
...       namespace = "my.app"
...       />
...
...   <extdirect:view
...       for="zope.app.folder.interfaces.IFolder"
...       class="falkolab.ext3.direct.testing.AlbumList"
...       permission="zope.ManageContent"
...       name="albumlist"
...       />
...
...   <extdirect:view
...       for="zope.app.folder.interfaces.IFolder"
...       class="falkolab.ext3.direct.testing.Contact"
...       permission="zope.ManageContent"
...       />
... </configure>
... """)

直接API:

>>> print http(r"""
... GET /@@directapi HTTP/1.1
... Authorization: Basic bWdyOm1ncnB3
... """)
HTTP/1.1 200 Ok
Cache-Control: no-cache
Content-Length: ...
Content-Type: text/javascript;charset=utf-8
Expires: ...
Pragma: no-cache
<BLANKLINE>
Ext.namespace('my.app');
my.app.REMOTING_API={"url": "http://localhost/@@directrouter", "namespace": "my.app", "type": "remoting", "actions": {"Contact": [{"name": "getInfo", "len": 1}], "albumlist": [{"formHandler": true, "name": "add", "len": 0}, {"name": "getAll", "len": 0}]}};

自动添加提供程序:

>>> print http(r"""
... GET /@@directapi?add_provider HTTP/1.1
... Authorization: Basic bWdyOm1ncnB3
... """)
HTTP/1.1 200 Ok
Cache-Control: no-cache
Content-Length: ...
Content-Type: text/javascript;charset=utf-8
Expires: ...
Pragma: no-cache
<BLANKLINE>
Ext.namespace('my.app');
my.app.REMOTING_API={"url": "http://localhost/@@directrouter", "namespace": "my.app", "type": "remoting", "actions": {"Contact": [{"name": "getInfo", "len": 1}], "albumlist": [{"formHandler": true, "name": "add", "len": 0}, {"name": "getAll", "len": 0}]}};
Ext.Direct.addProvider(my.app.REMOTING_API);

和直接请求hanling(有关添加,请参阅router.txt):

>>> print http(r"""
... POST /@@directrouter HTTP/1.1
... Authorization: Basic bWdyOm1ncnB3
... Content-Length: 71
... Content-Type: application/json; charset=UTF-8
... Referer: http://localhost/
...
... {"action":"albumlist","method":"getAll","data":[],"type":"rpc","tid":1}""")
HTTP/1.1 200 Ok
Content-Length: 89
Content-Type: text/javascript
<BLANKLINE>
{"action": "albumlist", "tid": 1, "type": "rpc", "method": "getAll", "result": [1, 2, 3]}

更改

1.1.0(2010-12-23)

  • 支持Python2.6的更改

1.0.1(2010-11-10)

  • 删除了对zope.app.intid的依赖关系
  • 更改为支持zope.component>;=3.6.0
  • 为simplejson编码器添加skipkeys=true以防止 引发类型错误

1.0.0A(2009-08-20)

  • 初次发布。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么在ng构建之后使用404?   java Maven原型“quickstart”无法扩展其POM   java Arduino端口卡在满功率状态   java如何确保在参数化构造函数失败时不调用默认构造函数?   java检测Blackberry中的切换失败   java如何将安卓库(作为Angle)链接到Eclipse项目?   java压缩图片,但获取“未知压缩方法”   java无法对应该初始化的模拟实例进行测试   将现有eclipse项目导出到war文件时,java“模块名无效”   java如何防止AppletClassLoader在查找类/其他资源时击中服务器?   java正则表达式根据分隔组的分隔符的数量获取n个组   java在JLayeredPane后面与JPanel交互   Java中的xml Soap请求   webView中的java utf8代码页