From 4209016fdf3173f12bf51ceb4589056308e8a52c 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 | 3 +++ src/collective/exportimport/import_content.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index d2481e20..0b2f2065 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -142,6 +142,9 @@ Changelog - Always import discussions independent if discussion support is enabled or not on a particular content object (#182) [ajung] +- 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 2a2d3d90..b9f4e713 100644 --- a/src/collective/exportimport/import_content.py +++ b/src/collective/exportimport/import_content.py @@ -1008,12 +1008,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=parent_type, id=element, title=element, ) + if constraints and constraints_state: + constraints.setConstrainTypesMode(constraints_state) + logger.info( u"Created container %s to hold %s", folder.absolute_url(),