Zope3的JSON RPC项树
项目描述
此软件包为Zope3提供JSON-RPC项树实现。
详细文档
JSONRPC树
此软件包提供了一种JSONRPC树视图,可以用作导航树。让我们看看如何注册我们的jsonrpc树视图
>>> from zope.configuration import xmlconfig >>> import z3c.jsonrpc >>> context = xmlconfig.file('meta.zcml', z3c.jsonrpc) >>> context = xmlconfig.string(""" ... <configure ... xmlns:z3c="http://namespaces.zope.org/z3c"> ... <z3c:jsonrpc ... for="*" ... class="z3c.jsontree.jsonrpc.JSONTreeItems" ... permission="zope.Public" ... methods="loadJSONTreeItems" ... layer="z3c.jsonrpc.testing.IJSONRPCTestSkin" ... /> ... </configure> ... """, context)
现在我们将基于默认的zope文件夹类设置一些内容结构
>>> from zope.site.folder import Folder >>> site = getRootFolder() >>> content = Folder() >>> site['content'] = content
我们需要能够获取表单的绝对URL
>>> import zope.interface >>> import zope.component >>> from zope.location.interfaces import ILocation >>> from zope.traversing.browser.interfaces import IAbsoluteURL >>> class FakeURL(object): ... zope.interface.implements(IAbsoluteURL) ... zope.component.adapts(ILocation, zope.interface.Interface) ... def __init__(self, context, request): ... pass ... def __str__(self): ... return u'http://fake/url' ... def __call__(self): ... return str(self)>>> zope.component.provideAdapter(FakeURL)
JSON-RPC代理
如果我们调用我们的JSON-RPC树项方法,我们可以看到不同上下文中的不同JSON数据
>>> from z3c.jsonrpc.testing import JSONRPCTestProxy >>> siteURL = 'https://127.0.0.1/++skin++JSONRPCTestSkin' >>> proxy = JSONRPCTestProxy(siteURL) >>> proxy.loadJSONTreeItems('z3cJSONTree') {u'treeChilds': {u'childs': [{u'hasChilds': False, u'contextURL': u'http://fake/url', u'url': u'http://fake/url/@@SelectedManagementView.html', u'linkHandler': u'', u'content': u'content', u'iconURL': u'', u'id': u'z3cJSONTree.::content'}], u'id': u'z3cJSONTree'}}
内容对象没有项目,返回一些空JSON数据
>>> proxy = JSONRPCTestProxy(siteURL + '/content') >>> proxy.loadJSONTreeItems('z3cJSONTree') {u'treeChilds': {u'childs': [], u'id': u'z3cJSONTree'}}
变更记录
0.6.0 (2010-09-23)
反映zope软件包中的变化,使用新的外部包
修复损坏的测试
修复:在javascript中处理className,新版本的JQuery无法处理$.className.has(ele, …),请使用$(ele).hasClass(…)代替。
修复:getParentsFromContextToObject,如果项目是代理NotFound错误对象,则不返回父链。可能此类NotFound对象将包装一个上下文,我们在父链中根本不允许。
0.5.1 (2009-03-10)
修复:使用最新包的导入,例如zope.site.folder.Folder
修复:智能处理NotFound错误对象。NotFound错误不可定位。
0.5.0 (2008-04-16)
修复:调整ITreeItems适配器。添加了额外的区分器,如果配置了基本注册,则可防止误用作/@@/适配器
实现了负责列出树中所有项目的ITreeItems适配器
初始发布
项目详情
关闭
z3c.jsontree-0.6.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 886a97b866f9e6988e0cd349d93dc61e1a159667343ec0da78d9ef66c401cac6 |
|
MD5 | be59020584a141a090449b53248a3fbd |
|
BLAKE2b-256 | 6dce8b65a7adaf9510a5ccb2e9f0817f72006ad98f33f3cd750df26dc1b5d082 |