skip to navigation
skip to content 2.3

Dolmen menu components

Downloads ↓ aims to provide the most flexible and explicit way to create and manage menus and their entries with Grok.

You have to know that...

  • only works on Python 2.6.
  • does not support sub-menus, out of the box. The implementation is left to your discretion.

Components provides two components:

  • Menu : the menu implementation is based on the zope "content provider" notion and is using the dolmen.viewlet package. It is a specific ViewletManager.
  • Entry: a menu item is called an entry. It's a viewlet, and as such, a multi adapter registered for a Menu component.


A menu component:

>>> class MyMenu(
...     menu.title('My nice menu')

A menu entry:

>>> class MyMenuEntry(
...     menu.order(1)
...     menu.title('My Entry')


In order to use base Grok component as menu entries, we get two registration ways.

class decorator

A class decorator allows you to decorate any View class, in order to register it as a menu entry:

>>> @menu.menuentry(MyMenu)
... class TestEntry(ViewClass):
...    def render(self):
...        return u"A simple entry"

Module level martian directive

A martian directive allows you register classes you can't decorate (from a foreign package, for instance), explicitly:

>>> class SomeView(ViewClass):
...    def render(self):
...        return u"I'm a view and I want to be a menu entry"

>>>, MyMenu, order=2)


2.2 (2012-05-06)

  • First attempt to make independant from security declarations. and are now optional.

2.1 (2012-05-06)

  • The last changes of cromlech.browser and the removal of are now ok. We also use the latest Please check the corresponding packages for more information.

2.0 (2012-01-26)

  • Ilanguage adaptation is no more mandatory as in dolmen.view
  • use cromlech.browser.testing.TestHTTPRequest in tests

2.0b2 (2011-11-24)

  • Fixed i18n using the new cromlech.i18n package.

2.0b1 (2011-08-29)

  • Added an available property on menu

2.0a2 (2011-05-25)

  • Entry is not longer a dolmen.viewlet.Viewlet. The component was grokked twice, because of that.

2.0a1 (2011-05-10)

  • We now use the Cromlech framework.
  • The naming of the component, set during the grokking, moved from __name__ to __component_name__.
  • The menu_entry decorator now supports two new parameters:
    • available, a callable that take one parameter, the menu entry
    • params, a dict to add parameters to the generated url.

0.5 (2011-01-31)

  • now works on the latest martian. The treatment of the decorator has been deferred by the use of a module annotation. The registration is now done by a global grokker.

0.4 (2010-12-24)

  • It is now possible to define a menu context, that is different of the rendering context. This allow delegated rendering, such as Root menus or other object-specific menus.

0.3 (2010-06-04)

  • Corrected a bug where 'zope.Public' was evaluated as a "normal" permission. Now, the manager converts the permission into a CheckerPublic marker.
  • the filter method is now a generator.

0.2 (2010-03-05)

  • Changed the way to fetch the menu CSS id.

0.1 (2010-03-03)

  • Initial release.
File Type Py Version Uploaded on Size # downloads (md5) Source 2013-07-22 12KB 0