Plone integration with plone.app.theming

Configurating and using Plone’s Diazo integration with plone.app.theming.

Using manifest.cfg for metadata

You can use the manifest.cfg to define the name and description of the theme and much more useful, you can define parameters to use in Diazo rules.

[theme]
title="Plone Theme: MyTheme"
description = "Diazo based Plone Theme"
doctype = <!Doctype html>

[theme:parameters]
language = portal_state/language
ajax_load = python: 'ajax_load' in request.form
anonymous = portal_state/anonymous

Then you can use this parameters in Diazo rules like this:

<notheme if="$ajax_load" />

Disabling the theme for a particular view, script or template

Some times you don’t want Diazo in the middle of your request/response. For example if you call some view over ajax and it must return just a string, Diazo break’s your string, because it converts a string to some thing like this:

<!Doctype html>
<html xmlns="http://www.w3.org/1999/xhtml"><body><p>True</p></body></html>

And this may break your application.

To get sure that Diazo let your response alone, you have to set the X-Theme-Disabled header:

response.setHeader('X-Theme-Disabled', 'True')

or directly from a template:

tal:define="dummy python:request.response.setHeader('X-Theme-Disabled', 'True')"