Reputation: 2876
I'm working in a project that creates a Plone 4.3 site that installs plone.app.contenttypes as it's default content types. After site creation I see all default content (the front page and some folders and collections) that are still Archetypes-based content.
I want to avoid the creation of that content and I want to know if there's a better way of getting rid of it that manually erasing it in a post install step.
I need an empty site by default.
Upvotes: 3
Views: 95
Reputation: 2876
There are a couple of ways of patching Plone to achieve this behavior by default.
One is by using z3c.jbot to override the following template:
Products/CMFPlone/browser/templates/plone-addsite.pt
The other is by using collective.recipe.patch in your Buildout configuration like this:
parts += patches
...
[patches]
recipe = collective.recipe.patch
egg = Products.CMFPlone==4.3.10
patches = ${buildout:directory}/patches/setup-content-false.patch
the content of the patch file is this (I would love to know how to get this without having to edit the output of the git diff
command):
diff --git Products/CMFPlone/browser/templates/plone-addsite.pt Products/CMFPlone/browser/templates/plone-addsite.pt
index bc83eb0..3aebbfe 100644
--- Products/CMFPlone/browser/templates/plone-addsite.pt
+++ Products/CMFPlone/browser/templates/plone-addsite.pt
@@ -99,7 +99,7 @@
</span>
</div>
<tal:content tal:condition="not:advanced">
- <input type="hidden" name="setup_content:boolean" value="true" />
+ <input type="hidden" name="setup_content:boolean" />
</tal:content>
<tal:baseprofile condition="python: len(base_profiles) > 1">
Upvotes: 0
Reputation: 6839
You need to setup the Plone Site the following way:
from Products.CMFPlone.factory import addPloneSite
from Products.CMFPlone.factory import _DEFAULT_PROFILE
default_profiles =('plonetheme.classic:default', 'plonetheme.sunburst:default')
return addPloneSite(
app,
site_id,
title=title,
profile_id=_DEFAULT_PROFILE,
extension_ids=default_profiles,
setup_content=False,
default_language='en')
The important part is setup_content=False
.
There's no initial content, no portlet... nothing.
You may check this full working example in ftw.inflator
-> https://github.com/4teamwork/ftw.inflator/blob/00b8b984e7dc1052a7fb94d2e82455a66b271da7/ftw/inflator/bundle.py#L23
Upvotes: 7