Skip to main content

Layout and page models for Dolmen applications

Project description provides ready-to-use components to get a fully functional and extensively pluggable User Interface for a Dolmen application (see

About Dolmen

Dolmen is an application development framework based on Grok and ZTK which also provides a CMS (Content Management System) out of the box. Dolmen is being made with four main objectives in mind: easily pluggable, rock solid and fast content type development, readability and speed.

Getting started

We import all the needed dependencies of the tests:

>>> import grok
>>> from dolmen.content import Content
>>> from zope.component import getMultiAdapter
>>> from zope.publisher.browser import TestRequest

We import everything needed for the API verification:

>>> from zope.interface import verify
>>> from import interfaces as API

We define and intanciate a Context object and a request for our tests to come:

>>> class Mammoth(Content):
...'Furry Mammoth')

>>> grok.testing.grok_component('mammoth', Mammoth)

>>> root = getRootFolder()
>>> root['manfred'] = Mammoth()
>>> manfred = root['manfred']

>>> request = TestRequest()

Global interface

>>> from import master
>>> API.IGlobalUI.extends(API.IContentProviders)
>>> API.IGlobalUI.providedBy(master)
>>> verify.verifyObject(API.IGlobalUI, master)

Content providers


>>> for name, attr in API.IContentProviders.namesAndDescriptions():
...   print "%s: %s" % (name, attr.getDoc())
Footer: Viewlet manager for the bottom part of the body.
AboveBody: Viewlet manager located above the main content.
BelowBody: Viewlet manager located below the main content.
Header: Viewlet manager involved in rendering the HTML head.
Top: Viewlet manager for the top part of the body.



>>> interfaceDescription(API.IGlobalUI)
Master: Base layout using all the `IContentProviders` components to build a coherent yet overridable rendering.

Contextual UI

>>> from import viewlets
>>> API.IContextualUI.providedBy(viewlets)
>>> verify.verifyObject(API.IContextualUI, viewlets)


>>> interfaceDescription(API.IContextualUI)
ContextualActions: Viewlet rendering contextual actions.
FlashMessages: Viewlet displaying site-wide messages.

View components

>>> from import models


Models are base classes to be used in your own classes. provides a collections of ready-to-use models:

>>> API.IModels.providedBy(models)
>>> verify.verifyObject(API.IModels, models)


>>> interfaceDescription(API.IModels)
Index: Page showing as default view on an object.
Form: Generic page form.
SubForm: Generic sub-form, used in composed forms.
TablePage: Page displaying a table.
Page: Page embedded in a layout.

All the models are megrok.layout.IPage components, allowing them to render inside a layout:

>>> from megrok.layout import IPage

>>> for name in list(API.IModels):
...    model = getattr(models, name)
...    print "%s:\t%s" % (name, IPage.implementedBy(model))
Index:        True
SubForm:      True
TablePage:    True
Page:         True
Form:         True

Default views registers some views, out-of-the-box, to allow you to interact with your dolmen.content objects and your application:

>>> API.IBaseViews.providedBy(models)
>>> verify.verifyObject(API.IBaseViews, models)


>>> interfaceDescription(API.IBaseViews)
Edit: Default edit form.
Add: Default add form.
DefaultView: Display form used as index.
Delete: Default delete form.


We can now test to see if our default views are retrieved:

>>> view = getMultiAdapter((manfred, request), name="index")
>>> view
< object at ...>

>>> edit = getMultiAdapter((manfred, request), name="edit")
>>> edit
< object at ...>

The add form is a bit different, as it relies on an adding view (see dolmen.forms.crud and dolmen.content for more information):

>>> from dolmen.forms.crud import Adder
>>> adding = Adder(root, request)
>>> adding
<dolmen.forms.crud.addview.Adder object at ...>
>>> adding.traverse("", None)
< object at ...>

Skins provides a browser layer and a skin, to serve as a base component for your own skins:

>>> from import skin

>>> API.ISkin.providedBy(skin)
>>> verify.verifyObject(API.ISkin, skin)


>>> interfaceDescription(API.ISkin)
IBaseSkin: Skin providing the IBaseLayer. Can be applied directly or inherited.
IBaseLayer: Layer used to register all the Dolmen centric view components.

Form compatibility

>>> from megrok.z3cform.base import IFormLayer
>>> skin.IBaseLayer.extends(IFormLayer)


All Dolmen packages are sponsorised by NPAI (


0.2 (2009-11-02)

  • Added Delete form to complete the CRUD actions.

0.1 (2009-11-02)

  • Initial release

Project details

Download files

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

Source Distribution (10.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page