Package: dolmen.app.layout
dolmen.app.layoutprovides ready-to-use components to get a fully
functional and extensively pluggable User Interface for a Dolmen
application (seedolmen.app.site).About DolmenDolmen 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 startedWe import all the needed dependencies of the tests:>>> from dolmen import content
>>> from grokcore.component import testing
>>> from zope.site.hooks import getSite
>>> from zope.component import getMultiAdapter
>>> from zope.publisher.browser import TestRequestWe import everything needed for the API verification:>>> from zope.interface import verify
>>> from dolmen.app.layout import interfaces as APIWe define and intanciate a Context object and a request for our tests
to come:>>> class Mammoth(content.Content):
...    content.name(u'Furry Mammoth')

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

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

>>> request = TestRequest()Global interface>>> from dolmen.app.layout import master>>> API.IGlobalUI.extends(API.IContentProviders)
True>>> API.IGlobalUI.providedBy(master)
True
>>> verify.verifyObject(API.IGlobalUI, master)
TrueContent providersDescription>>> 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.
Resources: Viewlet manager including resources.LayoutDescription>>> interfaceDescription(API.IGlobalUI)
Master: Base layout using all the `IContentProviders` components to build a coherent yet overridable rendering.Contextual UI>>> from dolmen.app.layout import viewlets>>> API.IContextualUI.providedBy(viewlets)
True
>>> verify.verifyObject(API.IContextualUI, viewlets)
TrueDescription>>> interfaceDescription(API.IContextualUI)
ContextualActions: Viewlet rendering contextual actions.
FlashMessages: Viewlet displaying site-wide messages.View components>>> from dolmen.app.layout import modelsModelsModels are base classes to be used in your own
classes.dolmen.app.layoutprovides a collections of ready-to-use
models:>>> API.IModels.providedBy(models)
True
>>> verify.verifyObject(API.IModels, models)
TrueDescription>>> interfaceDescription(API.IModels)
Index: Page showing as default view on an object.
Form: Generic page form.
Page: Page embedded in a layout.Default viewsdolmen.app.layoutregisters some views, out-of-the-box, to allow you
to interact with yourdolmen.contentobjects and your application:>>> API.IBaseViews.providedBy(models)
True
>>> verify.verifyObject(API.IBaseViews, models)
TrueDescription>>> interfaceDescription(API.IBaseViews)
Edit: Default edit form.
Add: Default add form.
DefaultView: Display form used as index.
Delete: Default delete form.QueryWe can now test to see if our default views are retrieved:>>> view = getMultiAdapter((manfred, request), name="index")
>>> view
<dolmen.app.layout.models.DefaultView object at ...>

>>> edit = getMultiAdapter((manfred, request), name="edit")
>>> edit
<dolmen.app.layout.models.Edit object at ...>The add form is a bit different, as it relies on an adding view (seedolmen.forms.crudanddolmen.contentfor more information):>>> from dolmen.forms.crud import Adder

>>> adding = Adder(root, request)
>>> adding
<dolmen.forms.crud.addview.Adder object at ...>

>>> adding.traverse("dolmen.app.layout.Mammoth", None)
<dolmen.app.layout.models.Add object at ...>Skinsdolmen.app.layoutprovides a browser layer and a skin, to serve as a
base component for your own skins:>>> from dolmen.app.layout import skin

>>> API.ISkin.providedBy(skin)
True
>>> verify.verifyObject(API.ISkin, skin)
TrueDescription>>> 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.
Resource: Viewlet component used to include resourcesMenus>>> from dolmen.app.layout import menus>>> API.IMenus.providedBy(menus)
True
>>> verify.verifyObject(API.IMenus, menus)
TrueDescription>>> interfaceDescription(API.IMenus)
ContextualMenu: Menu defining contextual actions.
MenuViewlet: Generic viewlet rendering a `IBrowserMenu`.Contextual menu>>> manager = master.Top(manfred, request, view)
>>> manager
<dolmen.app.layout.master.Top object at ...>>>> manager.update()
>>> print manager.render()
<dl id="contextual-actions" class="menu">
  <dt>Contextual actions</dt>
  <dd>
    <ul>
      <li class="selected entry">
        <a title="View">View</a>
      </li>
      <li class="entry">
        <a href="http://127.0.0.1/manfred/edit" title="Edit">Edit</a>
      </li>
      <li class="entry">
        <a href="http://127.0.0.1/manfred/delete" title="Delete">Delete</a>
      </li>
    </ul>
  </dd>
</dl>CreditsAll Dolmen packages are sponsorised by NPAI (http://www.npai.fr)Changelog1.0 (unreleased)Update to use grokcore.layout instead of megrok.layout.1.0b2 (2011-02-01)Updated versions dependencies to remove the use ofmegrok.resourcein favor offanstatic.1.0b1 (2010-11-16)The ContextualMenu viewlet now computes the URL using the ‘url’
attribute of the entries, as it should be.1.0a2 (2010-11-05)Dependencies have been slimmed down :dolmen.app.layoutnow longer
provides coverage for themegrok.z3ctableandzeam.form.composedpackages. We now rely on the grokcore packages and no longer on thegrokpackage itself.Tests no longer usezope.testing.1.0a1 (2010-06-03)The flash messages are now retrieved thanks togrokcore.message.Tests have been corrected and simplified.Using nowzeam.forminstead ofz3c.form.Using nowdolmen.menuinstead ofmegrok.menu.dolmen.app.layoutnow required python2.6 to work. This is due to
the use of class decorators.0.5.1 (2010-02-26)Corrected the success message getter for theDeleteform. It used
to fetch the property object and try to persist it. Now, it gets its
value as it should.0.5.0 (2010-02-25)Using now the latestmegrok.layout. This removes the need for theApplicationAwareViewmixin. This version ofdolmen.app.layoutwill
only work withGrok >= 1.1rc1.0.4.0 (2010-02-17)INotFound errors are not located in theindex.htmlview. This
allows to use a layout transparently. The __parent__ is set to theobattribute of the INotFound object.The contextual menu is no longer restricted toIBaseContentobjects. It is now registered forInterface.The dependencies have been greatly reduced by the removal of all thezope.apppackages.0.3.1 (2010-01-21)Bug fix: the success message of a Delete form is a property and
can’t be called directly through the class. We need to use fget.0.3 (2009-12-26)The layout now provides and uses a way to include resources, using
megrok.resourceviewlet. Two components have been added for that:ResourcesManagerandResource, respectively a viewletmanager and
a viewlet base class.The imports has been modified to avoid using any zope.app package.0.2.2 (2009-11-03)Now the configure.zcml includes themegrok.z3ctablemeta.zcml.Updated dependencies in setup.py0.2.1 (2009-11-02)Corrected flash messages and redirection in the delete form.0.2 (2009-11-02)Added Delete form to complete the CRUD actions.0.1 (2009-11-02)Initial release