Don't create default paragraphs if paragraphs list is not empty (which is the case when duplicating a content)
authorThierry Florac <thierry.florac@onf.fr>
Fri, 29 Sep 2017 10:29:36 +0200
changeset 183 6a4964dad8aa
parent 182 0c23e1a6b1b6
child 184 de7099d89ba4
Don't create default paragraphs if paragraphs list is not empty (which is the case when duplicating a content)
src/pyams_content/component/paragraph/__init__.py
--- a/src/pyams_content/component/paragraph/__init__.py	Thu Sep 21 16:06:29 2017 +0200
+++ b/src/pyams_content/component/paragraph/__init__.py	Fri Sep 29 10:29:36 2017 +0200
@@ -47,6 +47,8 @@
 def handle_new_paragraphs_container(event):
     """Handle new paragraphs container"""
     container = IParagraphContainer(event.object)
+    if len(container) > 0:
+        return
     content = get_parent(container, IWfSharedContent)
     version_state = IWorkflowState(content, None) if content is not None else None
     if (version_state is None) or (version_state.version_id == 1):