Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install z3c.jsontree

How to install z3c.jsontree

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install z3c.jsontree
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.6.0 Available View build log
0.5.1 Available View build log
Windows (64-bit)
0.6.0 Available View build log
0.5.1 Available View build log
Mac OS X (10.5+)
0.6.0 Available View build log
0.5.1 Available View build log
Linux (32-bit)
0.6.0 Available View build log
0.5.1 Available View build log
Linux (64-bit)
0.6.0 Available View build log
0.5.1 Available View build log
 
License
ZPL 2.1
Lastest release
version 0.6.0 on Jan 5th, 2011

This package provides an JSON-RPC item tree implementation for Zope3.

Detailed Documentation

JSONRPC Tree

This package offers a JSONRPC tree view which can be used as navigation tree. Let's show how we can register our jsonrpc tree view:

>>> 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)

Now we will setup some content structure based on the default zope folder class:

>>> from zope.site.folder import Folder
>>> site  = getRootFolder()
>>> content = Folder()
>>> site['content'] = content

And we need to be able to get an absoluteURL for the form:

>>> 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 proxy

If we call our JSON-RPC tree item method, we can see the different JSON data on the different contexts:

>>> from z3c.jsonrpc.testing import JSONRPCTestProxy
>>> siteURL = 'http://localhost/++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'}}

The content object has no items and returns some empty JSON data:

>>> proxy = JSONRPCTestProxy(siteURL + '/content')
>>> proxy.loadJSONTreeItems('z3cJSONTree')
{u'treeChilds': {u'childs': [], u'id': u'z3cJSONTree'}}
CHANGES
0.6.0 (2010-09-23)
  • reflect changes in zope packages, use new package externals
  • fix broken tests
  • Fix className handling in javacsript, it seems that newer version of JQuery

System Message: WARNING/2 (<string>, line 95)

Bullet list ends without a blank line; unexpected unindent.

can't handle $.className.has(ele, ...) use $(ele).hasClass(...) instead.

  • Fix: getParentsFromContextToObject, don't return a parent chain if an item

System Message: WARNING/2 (<string>, line 98)

Bullet list ends without a blank line; unexpected unindent.

is a location proxied NotFound error object. It's possible that such a NotFound object will wrap a context which we don't allow in our parent chain at all.

0.5.1 (2009-03-10)
  • Fix: use imports from newest packages e.g. zope.site.folder.Folder
  • Fix: be smart to NotFound error objects. NotFound errors are not locatable.
0.5.0 (2008-04-16)
  • Fix: adjust ITreeItems adapter. Added additional discriminator which

System Message: WARNING/2 (<string>, line 115)

Bullet list ends without a blank line; unexpected unindent.

prevents to get missused as /@@/ adapter if configured with base registry

  • implemented ITreeItems adapter which is responsible for list all items listed

System Message: WARNING/2 (<string>, line 118)

Bullet list ends without a blank line; unexpected unindent.

in tree

  • Initial Release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.