Skip to main content

Static Tree Implementation

Project description

This package was designed to be a light-weight and easy-to-use static tree implementation. It allows the developer to quickly create trees with nodes that can be opened and closed without the use of JavaScript. The tree state can be retained over multiple sessions.


What is ZopeTree?

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 Zope2’s ZTUtils.Tree was found to be too complicated and inflexible.

The 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.

How to use it

Using the skin

ZopeTree comes with a pre-defined skin, StaticTree. It looks just like Zope3’s default skin, Rotterdam, except that it displays a static tree in the navigation box instead of the Javascript/XML based dynamic tree.

Using predefined views on objects

ZopeTree comes with several predefined views:

simple view using cookies for tree state storage.
same as above, however only showing folders.
same as above, with the nearest site as root node.
same as above, with the root container as root node.

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 import OnlyInterfacesFilter
from 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 import IObjectFindFilter

class BendableFilter:

    def matches(self, obj)
        # only allow bendable objects
        return obj.isBendable()


Thanks to ZopeMag ( for sponsoring development of the original ZopeTree product.

Thanks to Runyaga LLC ( for sponsoring the Zope3 port.


4.0.0 (2017-05-16)

  • Add support for Python 3.4, 3.5, 3.6 and PyPy.
  • Fix #264614: Test for node filter didn’t do what it was expected to do.
  • Import ISite from zope.component after it was moved there from zope.location.

3.6.0 (2009-02-01)

  • Converted from using to zope.container.

3.5.1 (2009-01-29)

  • Add compatibility for newer zope.traversing releases that require us to explicitly set up testing. This also works with older releases.

3.5.0 (2009-01-17)

  • Get rid of dependency, replacing its uses with direct imports.
  • Clean up dependencies, move testing and rotterdam dependencies to extra requires.
  • Fix mailing list address to instead of retired Change cheeseshop to pypi in the package url.
  • Replace __used_for__ in with zope.component.adapts calls to make more sense.
  • Remove obsolete zpkg files, zcml include file for mkzopeinstance-based installations, versions.txt that makes no sense now.

3.4.0 (2007-10-28)

  • Initial release independent of the main Zope tree.

v1.2 (2004-02-19) – ‘Scruffy’

  • Moved to
  • It is now called ‘ZopeTree’ again. Hoorray!
  • Refactored browser stuff into its own browser subpackage.
  • Separated the handling of tree state from the cookie functionality to provide a base class for views based on other tree state sources.

v1.1 (2004-02-16) – ‘Zapp’

  • Added support for displaying lines in a tree (Stephan Richter)
    • Changes in Node.getFlatDict() to provide more data. Removed ‘depth’ from node info, but added ‘row-state’ and ‘last-level-node’. Changed interface and test accordingly.
    • Updated templates for StaticTree skin and example. Note that third party templates from 1.0.x will not work anymore and must be updated as well!

v1.0.1 (2004-01-16) – ‘Nibbler’

  • Added last remaining pieces for unit tests
  • Updated documentation
  • Rounded some rough edges in the skin
  • Integrated it into the Zope3 distribution below the zope.products package

v1.0 (2003-11-24) – ‘Lur’

  • Ported to Zope 3
  • Renamed it to ‘statictree’
  • Much more unit tests
  • Added filter functionality
  • Provided sample implementations as well as an alternate rotterdam-like skin using the static tree

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for, version 4.0.0
Filename, size File type Python version Upload date Hashes
Filename, size (37.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size (23.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page