From cd0e0c7df3bd533d631c34a48629b6339a69fe0f Mon Sep 17 00:00:00 2001 From: ale-rt Date: Thu, 26 Jan 2023 16:11:27 +0100 Subject: [PATCH] Temporarily disallow constraints when creating the parent folder chain Fixes #173 --- CHANGES.rst | 4 +++- src/collective/exportimport/import_content.py | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 048e9d46..0d11be45 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,9 @@ Changelog 1.8 (unreleased) ---------------- -- Nothing changed yet. +- Temporarily disallow constraints when creating the parent folder chain. + (#173) + [ale-rt] 1.7 (2023-01-20) diff --git a/src/collective/exportimport/import_content.py b/src/collective/exportimport/import_content.py index 7162a616..0416a348 100644 --- a/src/collective/exportimport/import_content.py +++ b/src/collective/exportimport/import_content.py @@ -900,12 +900,19 @@ def create_container(self, item): # create original structure for imported content for element in parent_path: if element not in folder: + constraints = ISelectableConstrainTypes(folder, None) + constraints_state = constraints and constraints.getConstrainTypesMode() + if constraints_state: + constraints.setConstrainTypesMode(0) folder = api.content.create( container=folder, type="Folder", id=element, title=element, ) + if constraints and constraints_state: + constraints.setConstrainTypesMode(constraints_state) + logger.info( u"Created container {} to hold {}".format( folder.absolute_url(), item["@id"]