Skip to content

Commit

Permalink
Temporarily disallow constraints when creating the parent folder chain
Browse files Browse the repository at this point in the history
Fixes #173
  • Loading branch information
ale-rt authored and thet committed Apr 17, 2024
1 parent 6f8834b commit 4209016
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions src/collective/exportimport/import_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 4209016

Please sign in to comment.