blocks Package

interfaces Module

layoutbehavior Module

class plone.app.blocks.layoutbehavior.LayoutField(*args, **kw)[source]

Bases: zope.schema._bootstrapfields.Text

A field used to store layout information

panel Module

plone.app.blocks.panel.merge(request, pageTree, removePanelLinks=False, removeLayoutLink=True)[source]

Perform panel merging for the given page.

Returns None if the page has no layout.

resource Module

class plone.app.blocks.resource.AvailableLayoutsVocabulary(format, defaultFilename)[source]

Bases: object

Vocabulary to return available layouts of a given type

class plone.app.blocks.resource.DefaultSiteLayout(context, request)[source]

Bases: zope.publisher.browser.BrowserView

Look up and render the site layout to use for the context.

Use this for a page that does not have the ILayout behavior, or a standalone page template.

The idea is that you can do:

<html data-layout=”./@@default-site-layout”>

and always get the correct site layout for the page, taking section- specific settings into account.

class plone.app.blocks.resource.PageSiteLayout(context, request)[source]

Bases: plone.app.blocks.resource.DefaultSiteLayout

Look up and render the site layout to use for the context.

Use this for a page that does have the ILayout behavior. It will take the pageSiteLayout property into account.

The idea is that you can do:

<html data-layout=”./@@page-site-layout”>

and always get the correct site layout for the page, taking section- and page-specific settings into account.

class plone.app.blocks.resource.SiteLayoutTraverser(context, request=None)[source]

Bases: plone.resource.traversal.ResourceTraverser

The site layout traverser.

Allows traveral to /++sitelayout++<name> using plone.resource to fetch things stored either on the filesystem or in the ZODB.

name = 'sitelayout'
plone.app.blocks.resource.cacheKey(method, self)[source]

Invalidate if the fti is modified, the global registry is modified, or the content is modified

plone.app.blocks.resource.globalSiteLayoutModified(event)[source]

Invalidate caches if the global site layout is changed. This will likely also affect things cached using plone.app.caching, which is what we want - the page has probably changed

testing Module

tiles Module

plone.app.blocks.tiles.renderTiles(request, tree)[source]

Find all tiles in the given response, contained in the lxml element tree tree, and insert them into the ouput.

Assumes panel merging has already happened.

transform Module

class plone.app.blocks.transform.DisableParsing(published, request)[source]

Bases: object

A no-op transform which sets flags to stop plone.app.blocks transformations. You may register this for a particular published object or request as required. By default, it’s registered for ESI- rendered tiles when they are fetched via ESI.

order = 8000
transformIterable(result, encoding)[source]
transformString(result, encoding)[source]
transformUnicode(result, encoding)[source]
class plone.app.blocks.transform.ESIRender(published, request)[source]

Bases: object

If ESI rendering was used, render the page down to a format that allows ESI to work.

order = 8900
transformIterable(result, encoding)[source]
transformString(result, encoding)[source]
transformUnicode(result, encoding)[source]
class plone.app.blocks.transform.IncludeTiles(published, request)[source]

Bases: object

Turn a panel-merged page into the final composition by including tiles. Assumes the input result is an lxml tree and returns an lxml tree for later serialization.

order = 8500
transformIterable(result, encoding)[source]
transformString(result, encoding)[source]
transformUnicode(result, encoding)[source]
class plone.app.blocks.transform.MergePanels(published, request)[source]

Bases: object

Find the site layout and merge panels.

order = 8100
transformIterable(result, encoding)[source]
transformString(result, encoding)[source]
transformUnicode(result, encoding)[source]
class plone.app.blocks.transform.ParseXML(published, request)[source]

Bases: object

First stage in the 8000’s chain: parse the content to an lxml tree encapsulated in an XMLSerializer.

The subsequent steps in this package will assume their result inputs are XMLSerializer iterables, and do nothing if it is not. This also gives us the option to parse the content here, and if we decide it’s not HTML, we can avoid trying to parse it again.

order = 8000
pretty_print = False
transformIterable(result, encoding)[source]
transformString(result, encoding)[source]
transformUnicode(result, encoding)[source]

utils Module

plone.app.blocks.utils.append_tail(element, text)[source]
plone.app.blocks.utils.append_text(element, text)[source]
plone.app.blocks.utils.extractCharset(response, default='utf-8')[source]

Get the charset of the given response

plone.app.blocks.utils.getDefaultSiteLayout(context)[source]

Get the path to the site layout to use by default for the given content object

plone.app.blocks.utils.getLayoutAwareSiteLayout(context)[source]

Get the path to the site layout for a page. This is generally only appropriate for the view of this page. For a generic template or view, use getDefaultSiteLayout(context) instead.

plone.app.blocks.utils.replace_content(element, wrapper)[source]

Similar to above but keeps parent tag

plone.app.blocks.utils.replace_with_children(element, wrapper)[source]

element.replace also replaces the tail and forgets the wrapper.text

plone.app.blocks.utils.resolve(url)[source]

Resolve the given URL to an lxml tree.

plone.app.blocks.utils.resolveResource(url)[source]

Resolve the given URL to a unicode string. If the URL is an absolute path, it will be made relative to the Plone site root.

plone.app.blocks.utils.xpath1(xpath, node, strict=True)[source]

Return a single node matched by the given etree.XPath object.

Table Of Contents

Previous topic

Complete API and advanced usage

Next topic

deco Package

This Page