I\'m trying to achieve a repeatable deployment of Plone for a site, and using buildout, basically following Martin Aspeli\'s book Professional Plone 4 Development.
In principle buildout can do anything you can code, as long as you create a recipe to do the thing for you.
Luckily, someone already created a recipe to create the plone site for you, called collective.recipe.plonesite:
[buildout]
parts =
...
plonesite
[plonesite]
recipe = collective.recipe.plonesite
site-id = <site>
profiles-initial =
<site>.policy.profile-default
post-extras =
${buildout}/src/<site>.content/site/content/create_content.py
The recipe provides several hooks that let you control site creation, and execute system commands before or after the site is created or extra python code before or after GS profiles are run.
In the above example post-extras
runs a create_content.py
script with the variables app
and site
set:
from Products.CMFPlone.utils import _createObjectByType
if 'someobject' not in site:
_createObjectByType('SomeType', site, 'someobject', title='Foo Bar')