Package: isotoma.recipe.plonetools
IntroductionThis recipe is based oncollective.recipe.plonesite. It provides recipes for creating and updating Plone sites, running scripts against Plone sites and for setting their properties. If you use zeoserver, all the recipes will start and stop zeo appropriately (not stopping it if it wasnt the process that started it, for example). When combined withisotoma.recipe.zope2instanceit can properly deal with errors, ending the buildout run rather than continuing and succeeding.Managing plone sitesThis recipe enables you to create and update a Plone site as part of a buildout run.  This recipe only aims to run profiles and Quickinstall products.  It is assumed that the install methods, setuphandlers, upgrade steps, and other recipes will handle the rest of the work.To use it, add something like this to your recipe:[plonesite]
recipe = isotoma.recipe.plonetools:site
products =
    LinguaPlone
    iw.fss
    you.YourProductParameters[1](1,2)Profiles have the following format:<package_name>:<profile>(e.g.my.package:default).  The profile can also be prepended with theprofile-if you so choose (e.g.profile-my.package:default).[2](1,2)The product name is typicallynotthe package name such asProducts.MyProduct, but just the product nameMyProduct. Quickest way to find out the name that is expected is to ‘inspect’ the Quickinstaller page and see what value it is passing in.site-idThe id of the Plone site that the script will create.  This will also be used to update the site once created.  Default: Ploneadmin-userThe id of an admin user that will be used as the ‘Manager’.  Default: adminproducts-initialA list of products to quickinstall just after initial site creation. See above for information about the product name format[2].profiles-initalA list of GenericSetup profiles to run just after initial site creation. See above for informaion on the expected profile id format[1].productsA list of products to quickinstall each time buildout is run. See above for information about the product name format[2].profilesA list of GenericSetup profiles to run each time buildout is run. See above for informaion on the expected profile id format[1].instanceThe name of the instance that will run the script. Default: instancezeoserverThe name of the zeoserver part that should be used.  This is only required if you are using a zope/zeo setup. Default: not setbefore-installA system command to execute before installing Plone.  Optional.  You could use this to start a Supervisor daemon to launch ZEO, instead of launching ZEO directly.  You can use this option in place of the zeoserver option.after-installA system command to execute after installing Plone.  Optional.site-replaceReplace any existing plone site named site-id. Default: falseenabledOption to start up the instance/zeoserver.  Default: true.  This can be a useful option from the command line if you do not want to start up Zope, but still want to run the complete buildout.$ bin/buildout -Nv plonesite:enabled=falsepre-extrasAn absolute path to a file with python code that will be evaluated before running Quickinstaller and GenericSetup profiles.  Multiple files can be given.  Two variables will be available to you.  The app variable is the zope root.  The portal variable is the plone site as defined by the site-id option. NOTE: file path cannot contain spaces. Default: not setpost-extrasAn absolute path to a file with python code that will be evaluated after running Quickinstaller and GenericSetup profiles.  Multiple files can be given.  Two variables will be available to you.  The app variable is the zope root.  The portal variable is the plone site as defined by the site-id option. NOTE: file path cannot contain spaces. Default: not setpropertiesThe name of a part that provides propert name value mappings.Setting propertiesYou can set properties on your plone site object from buildout:[portal-properties]
somestring = some string
somebool = True
somelist =
    1
    2
    3

[plonesite]
recipe = isotoma.recipe.plonetools:site
<SNIP>
properties = portal-propertiesProperties set in this way are set at the same time as the Plone Site object is
updated, during the same zope instance invocation so is more efficient than
using a seperate recipe.Calling Setters On Plone ObjectsAs a last resort you can call setters directly from buildout. This is meant
for things like CacheSetup where your cached domains might vary between
environments.Just add:[mutators]
some.object.setFoo = True
some.object.setList =
    1
    2
    3
some.other.object.setBar = some string

[plonesite]
recipe = isotoma.recipe.plonetools:site
<SNIP>
mutators = mutatorsAgain, these are set at the same time as the portal properties are applied
and as GenericSetup is run - no extra zope invocations are required.The migration scriptIf you have a plonesite:site stanza in your buildout you will get a plonesite
script in your bin directory.Running this script with no arguments will apply run the same processes that
run during buildout.Running the script with the-rargument will cause it to rebuild the site,
deleting your Plone site object and recreating it. Great for sandboxes that
reset nightly.Creating wrapper scriptsThis recipe lets you create a script in your buildouts bin-directory to run a
script for you under the correct zope instance.If you have a script in mypackage.myscript:def run():
    print "This is my test scriptthen add something like this to your recipe:[instance]
recipe = isotoma.recipe.zope2instance
otherprops = here

[wrappers]
recipe = isotoma.recipe.plonetools:wrapper
instance = instance
entry-points =
   myscript=mypackage.myscript:runMandatory parametersentry-pointsThese are like the entry-points used in setuptools, in the form of wrappername=your.product.module:functionOptional parametersinstanceThe name of a zope2instance part that is used to run the script. Default: instance.argumentsSome arguments to be passed to the entry points, as python. Default: appChangelog0.0.17 (2014-11-20)Ignore existing PYTHPONPATH when calling sub-scripts.0.0.16 (2012-10-09)The most sensible process is:Create empty siteRun initial profilesRun main profilesMigrate mount pointsI think.0.0.15 (2012-10-05)Fix regression in migrate script.0.0.14 (2012-10-03)Automatic migration to split Data.fs when mount points are declared in zope.conf0.0.13 (2011-09-29)Add a new ‘rootify’ option. It’s only available to virtualenv peeps atm.0.0.12 (2011-09-23)Fix Plone 3 support (creating new site was impacted by the 4.1/2.5 changes)0.0.11 (2011-09-22)The properties and script helper are no longer supportedWrite a script that can run migrations without running the rest of buildoutThis script supports a ‘-r’ flag for rebuild the /portal object from scratch.Don’t hang if CMFSquidTool has a purge queue that is unendingDrop JSON dependencyBetter 2.5 and 4.1 support0.0.10 (2011-09-21)Use savepoint() instead of subtransactionMore useful output when quick installing and applying profiles0.0.9 (2011-09-03)Add support for calling any setters from buildout.If a transient error occurs, retry up to${:attempts}times.0.0.8 (2011-08-30)Support subtransactions (stops CacheSetup hanging)Allow the Site recipe to set properties without a seperate properties part0.1 (2010-04-24)Created friendly fork of collective.recipe.plonesiteCatch non-zero exit codesAdded a test to see if zeo is running before starting itOnly shutdown zeo if we started it