Static Tree Implementation
ZopeTree is a port of Philipp’s Zope2 product ZopeTree. ZopeTree was
meant to be a light-weight and easy-to-use static tree implementation,
mainly designed for use in ZPTs. It was originally written because
ZTUtils.Tree was found to be too complicated and inflexible.
ZTUtils package has not been ported to Zope3. Parts of it, like
batching, have found their way into Zope3, though. Only support for
static tree generation is not in the core.
ZopeTree comes with several predefined views:
The example page template(s) in the browser package give an idea how to use these views for HTML templating.
The best way to customize ZopeTree is to define your own view for objects (usually ‘*’). If you want to use the cookie functionality, simply extend the cookie browser view:
from zope.app.tree.filters import OnlyInterfacesFilter from zope.app.tree.browser.cookie import CookieTreeView class BendableStaticTreeView(StaticTreeView): def bendablesTree(self): # tree with only IBendables, but also show the folder # they're in filter = OnlyInterfacesFilter(IBendable, IFolder) return self.cookieTree(filter)
You can also write your own filters. All you have to do is implement the IObjectFindFilter interface (which is trivial):
from zope.interface import implements from zope.app.interfaces.find import IObjectFindFilter class BendableFilter: implements(IObjectFindFilter) def matches(self, obj) # only allow bendable objects return obj.isBendable()
This product is released under the terms of the Zope Public License
(ZPL) v2.1. See the
ZopePublicLicense.txt file at the root of your
Copyright (c) 2003 Philipp “philiKON” von Weitershausen Copyright (c) 2004 Zope Corporation and Contributors
pypiin the package url.
Node.getFlatDict()to provide more data. Removed ‘depth’ from node info, but added ‘row-state’ and ‘last-level-node’. Changed interface and test accordingly.
StaticTreeskin and example. Note that third party templates from 1.0.x will not work anymore and must be updated as well!
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|zope.app.tree-4.0.0-py2.py3-none-any.whl (37.0 kB) Copy SHA256 Checksum SHA256||py2.py3||Wheel||May 16, 2017|
|zope.app.tree-4.0.0.tar.gz (23.7 kB) Copy SHA256 Checksum SHA256||–||Source||May 16, 2017|