GenericSetup profiles for plone.app.theming
Project description
collective.themesitesetup
collective.themesitesetup is a plone.app.theming-plugin for embedding GenericSetup-steps into zipped theme packages.
collective.themesitesetup can automatically import one embedded set of generic setup steps during theme activation and another one (so called uninstall profile) when theme is deactivated. Yet, also additionals ets can be embedded and imported manually.
See it activating theme site setup at: https://youtu.be/3vkrc7JFUU0
Note: Due to regression in the plugin support in plone.app.theming, the automatic import of setup steps require a currently (as of 2015-04-04) unreleased version with one of the fixing pull requests merged (1, 2, 3).
Installation
Simply include this package into your Plone site buildout by following the official instructions. This add-on doesn’t require other activation, but, of course, requires plone.app.theming to be activated.
Configuration
This plugin is enabled for any theme by simply adding the following line into theme’s manifest.cfg:
[theme:genericsetup]
By default, this looks for the setup steps to be imported during activation from theme’s install-subdirectory and the steps to be imported during deactivation from theme’s uninstall-subdirectory. If such directory does not exist, this plugin simply does not import any steps.
The default lookup directories can be customized by overriding the defaults with custom values in theme’s manifest.cfg:
[theme:genericsetup]
install = my-install
uninstall = my-uninstall
This plugin can also be disabled at any time simply by adding the line disabled = true into plugin’s configuration in theme’s manifest.cfg:
[theme:genericsetup]
disabled = true
Message catalogs
This plugin can also be used to register (and unregister) i18n message catalogs directly from the theme. By default, the plugin looks for message catalogs from locales subdirectory of the theme, expecting the usual message catalog directory structure:
./locales/en/LC_MESSAGES/foo.po
./locales/en/LC_MESSAGES/bar.po
In the above example, two message catalogs, one for language en for domain foo and another for language en for domain bar are registered.
The default locales directory name can be changed with:
[theme:genericsetup]
locales = my_locales
The registered message catalogs are unregistered when the theme is deactivated.
Exporting the site setup
This plugin provides helper forms for exporting the current site setup into a through-the-web created (writable) theme and importing that site setup manually from the theme folder.
The export form is registered for the theme resource directory as @@export-site-setup and the import form as @@import-site-setup.
The export form is useful for creating the initial site setup into the theme directory. Simply
Create a new theme from Theming control panel
Go to the export form URL, e.g. http://localhost:8080/Plone/++theme++my-theme/@@export-site-setup:
Choose the steps you wish to export and click Export.
Editing the site setup
The site setup steps can be edited like any theme file through the theme editor:
Tip: You can Use six feet up’s great Generic Setup reference card as cheat cheet for editing the site setup files.
Note: Because the theme editor hides all dotfiles, files starting with a dot must be renamed to end with .dotfile (and to not start with a dot).
Importing the setup
By default, this plugin is configured import setup steps from a directory install whenever the theme is activated, and steps from a directory uninstall, when the theme is deactivated. Both, install and uninstall step directory can be changed in the plugin configuration.
In addition, it’s possible to import the embedded steps manually using the import setup form. Simply
Go to the import form URL for your theme, e.g. http://localhost:8080/Plone/++theme++my-theme/@@import-site-setup:
Choose the steps you wish to import and click Import.
Better site structure export and import
This package includes optional enhancements for the default Plone site structure export and import.
The enhancements include:
support for News Item contents
support for Zope Page Templates
support for Python Scripts
support for exporting tagged hidden folders (like portal_skins/custom)
The enhancements can be activated by including a special component configuration file in your Plone buildout’s instance parts with:
[instance]
...
zcml = collective.themesitesetup-extras
ZMI-only content, which is hidden in Plone (folders like portal_skins) can be included in the export by tagging the folders in ZMI interface tab with a special marker interface:
``collective.themesitesetup.interfaces.IGenericSetupExportableContainer``
PageTemplates and PythonScripts can only be exported when they are located in a ZMI-only container with this marker interface. So, if you’d like to export contents in portal_skins/custom, you should add one marker for portal_skins and the other for custom.
This is only required when exporting ZMI-only content. Importing ZMI-only content works according to normal structure import rules without these marker interfaces.
About plone.app.contenttypes support
Better site structure export and import described above must be enabled to support exporting and importing site structures with plone.app.contenttypes based content.
In addition, plone.app.textfield >=1.2.5 is recommended to fix issue, where structure import does not decode field value properly, causing UnicodeDecodeErrors later.
About custom Dexterity content support
Importing site structures with custom Dexterity content types require custom adapter to be implemented and registered for each content type
from Products.GenericSetup.interfaces import IContentFactory
from collective.themesitesetup.content import DexterityContentFactoryBase
from plone.dexterity.interfaces import IDexterityContent
from zope.component import adapter
from zope.interface import implementer
@adapter(IDexterityContent)
@implementer(IContentFactory)
class MyTypeFactory(DexterityContentFactoryBase):
portal_type = 'MyType'
<adapter
factory=".adapters.MyTypeFactory"
name="MyType"
/>
This is not required when Dexterity content is only created into site root or Archetypes based container.
Changelog
1.0.0 (2016-08-11)
Add support for registering i18n message catalogs directly from theme [datakurre]
0.13.0 (2015-04-23)
Add support for exporting and importing plone.app.contenttypes -content [datakurre]
0.12.0 (2015-04-04)
Move custom GS import export adapters to external configuration [datakurre]
Fix to register setup forms for p.a.theming layer [datakurre]
0.11.1 (2015-04-04)
Update README [datakurre]
0.11.0 (2015-04-04)
Add site setup import view to allow testing or manual upgrading of site setups [datakurre]
Add option to disable setup steps import via plugin configuration variable in theme manifest (either with enabled = false or disabled = true) [datakurre]
0.10.0 (2015-04-03)
Add GS content export support to include non-CMF-containers marked with collective.themesitesetup.interfaces.IGenericSetupExportableContainer [datakurre]
Add GS content export/import to support non-CMF-containers, PythonScripts and PageTemplates. [datakurre]
0.9.0 (2015-04-01)
First release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for collective.themesitesetup-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e00f330b3cce399507e56862367120073137d024d73499dfe4852ae8e2e65b8e |
|
MD5 | 7d338a2c3bb29931df8ba3b1cb29407e |
|
BLAKE2b-256 | 82d2e3c666e05bc97d37e6f8cd7eae4ea7cba91d46fe8fc622414f10a24cbecc |