cybertools/composer/layout
2015-01-09 13:03:39 +01:00
..
browser use simple HTML 5 doctype to make Google happy 2015-01-09 13:03:39 +01:00
__init__.py created composer.layout package 2008-07-15 11:53:56 +00:00
base.py provide defaultSublayout property 2009-06-29 09:29:56 +00:00
configure.zcml work in progress: layout management - first working page with CSS 2008-09-20 08:45:15 +00:00
interfaces.py work in progress: layout management 2008-10-08 20:28:21 +00:00
README.txt let layouts register themselves automatically as utilities upon creation 2008-12-15 16:07:35 +00:00
region.py work in progress: layout management - first working page with CSS 2008-09-20 08:45:15 +00:00
tests.py created composer.layout package 2008-07-15 11:53:56 +00:00

=================
Layout Management
=================

  ($Id$)

Let's start with some basic setup; the traversable adapter is needed for
rendering the page templates.

  >>> from zope import component
  >>> from zope.interface import Interface
  >>> from zope.traversing.adapters import DefaultTraversable
  >>> component.provideAdapter(DefaultTraversable, (Interface,))

For testing we define a simple content class.

  >>> class Document(object):
  ...     text = ''

The layout management is controlled by a global utility, the layout
manager.

  >>> from cybertools.composer.layout.base import LayoutManager, LayoutInstance
  >>> from cybertools.composer.layout.interfaces import ILayout

  >>> manager = LayoutManager()
  >>> component.provideUtility(manager)

The layouts themselves are also specified as utilities that are automatically
registered when we import the modules they are defined in.

  >>> from cybertools.composer.layout.browser import default
  >>> from cybertools.composer.layout.browser.liquid import default

In addition we have to provide at least one layout instance adapter that
connects a layout with the client object.

  >>> component.provideAdapter(LayoutInstance, (object,))


Browser Views
=============

  >>> from cybertools.composer.layout.browser.view import Page
  >>> from zope.publisher.browser import TestRequest

  >>> page = Page(Document(), TestRequest())

  >>> page()
  u'<!DOCTYPE ...>...<html ...>...</html>...'