tkimnguyen
(T. Kim Nguyen)
October 30, 2025, 9:03pm
1
In Creating objects — Plone Documentation v5.2 (yes, old version) the .preserve file is supposed to allow you to prevent overwriting of content items, specified by their ID.
in profiles/default/structure there is a .objects file containing:
tools,Folder
notes,Folder
images,Folder
documents,Folder
and a .preserve file containing
tools
notes
documents
images
But the .preserve file is not being respected: anything that existed inside, say, the tools folder is gone after I uninstall and reinstall the add-on.
Where in Plone does this code live? I'd love to step through it...
davisagli
(David Glick)
October 30, 2025, 9:24pm
2
From what I can see it does not prevent overwriting, but it does prevent deleting the existing item before overwriting it. Products.GenericSetup/src/Products/GenericSetup/content.py at master · zopefoundation/Products.GenericSetup · GitHub
If you have a version of Plone that still uses portal_quickinstaller then your problem might also be at the uninstall step, where it deletes any objects that were added to the portal during installation: Products.CMFQuickInstallerTool/Products/CMFQuickInstallerTool/InstalledProduct.py at master · plone/Products.CMFQuickInstallerTool · GitHub You can avoid that by doing a reinstall rather than separate uninstall and install steps: Products.CMFQuickInstallerTool/Products/CMFQuickInstallerTool/QuickInstallerTool.py at master · plone/Products.CMFQuickInstallerTool · GitHub
1 Like
espenmn
(Espen)
October 31, 2025, 3:37pm
3
Just a thought: could it be ok to check if folder exists and then run a profile if it does not?
In setuphandlers you could check for (example):
def post_install(context):
portal = api.portal.get()
if not portal.get('templates', False):
## install profile 'add_templates'
1 Like
tkimnguyen
(T. Kim Nguyen)
October 31, 2025, 5:19pm
4
This is on Plone 6.1.3.
Uninstall does not remove the contents of the tools and notes folders, so it's at the install step that it must be happening.
It looks like .preserve should be renamed to something more honest
Yeah, I am going to try using a setup handler...
davisagli
(David Glick)
October 31, 2025, 5:36pm
5
On Plone 6.1, maybe you want to use plone.exportimport (which is based on plone.restapi serialization to JSON) instead of the old GenericSetup content thing.