Clear comments when creating new version
authorThierry Florac <thierry.florac@onf.fr>
Fri, 10 Nov 2017 12:07:09 +0100
changeset 275 0c63253d75bd
parent 274 dec73d3ec647
child 276 78422a1c4228
Clear comments when creating new version
src/pyams_content/shared/common/zmi/__init__.py
--- a/src/pyams_content/shared/common/zmi/__init__.py	Fri Nov 10 12:06:33 2017 +0100
+++ b/src/pyams_content/shared/common/zmi/__init__.py	Fri Nov 10 12:07:09 2017 +0100
@@ -20,11 +20,11 @@
 # import interfaces
 from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION, MANAGE_CONTENT_PERMISSION, CREATE_CONTENT_PERMISSION, \
     PUBLISH_CONTENT_PERMISSION
-from pyams_content.interfaces.review import IReviewComments
+from pyams_content.features.review.interfaces import IReviewComments
 from pyams_content.shared.common.interfaces import IWfSharedContent, ISharedContent, ISharedTool, IManagerRestrictions
 from pyams_form.interfaces.form import IFormContextPermissionChecker, IWidgetsPrefixViewletsManager
 from pyams_i18n.interfaces import II18n, II18nManager
-from pyams_sequence.interfaces import ISequentialIntIds, ISequentialIdInfo
+from pyams_sequence.interfaces import ISequentialIdInfo
 from pyams_skin.interfaces import IContentTitle
 from pyams_skin.interfaces.container import ITable, ITableElementEditor
 from pyams_skin.interfaces.viewlet import IContextActions, IMenuHeader, IBreadcrumbItem
@@ -290,7 +290,10 @@
         new_version.creator = self.request.principal.id
         new_version.owner = self.request.principal.id
         new_version.modifiers = set()
-        IReviewComments(new_version).clear()
+        # check comments
+        comments = IReviewComments(new_version, None)
+        if comments is not None:
+            comments.clear()
         # store new version
         translate = self.request.localizer.translate
         workflow = get_utility(IWorkflow, name=new_content.workflow_name)