This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

infrae.layout defines a way to write view that can reuse an existing defined layout in Zope 2. It is similar to megrok.layout, and work the same way, with some additions.


You can define a Layout that will be used by a Page. A Page is a view and behave the same way. A page will look for Layout and will render inside it.

Both Page and Layout can be rendered by either a render method, or by an associated template, exactly like a Grok view.

A Layout is found by adapting the request and the content: you can register layouts for your skin, then for a specific content.

If this is not sufficient, a page can use the Grok directive layout to directly specify its type of Layout to use. While defining your layout, you can use the same directive to declare which layout a type belongs to. For instance if you have a skin ICorpSkin:

from infae.layout import layout, Layout, ILayout, Page
from five import grok

from import ICorpSkin

class ViewLayout(Layout):

   def render(self):
       return u'View %s' % self.view.content()

class Index(Page):

   def render(self):
       return self.context.title()

Now if on the same content you want an edition layout for instance:

class IEditionLayout(ILayout)
    """Layout to edit content

class EditionLayout(Layout):

    def render(self):
        return u'Edit %s' % self.view.content()

class Edit(Page):

   def render(self):
        return self.context.title()

If the above mecanism is not flexible enough for your application, you can write an adapter on the request and your content that provides ILayoutFactory. The adapter will allow you to code the logic to select any layout you want.


1.0 (2010/07/16)

  • Initial release.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
infrae.layout-1.0.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 Source Jul 16, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting