Updated creation form data extraction
authorThierry Florac <thierry.florac@onf.fr>
Wed, 07 Mar 2018 16:18:21 +0100
changeset 451 8467cbd639b5
parent 450 9a6afbc6ab4f
child 452 7251fb345939
Updated creation form data extraction
src/pyams_content/features/review/zmi/__init__.py
src/pyams_content/shared/common/zmi/__init__.py
src/pyams_content/shared/common/zmi/owner.py
src/pyams_content/shared/common/zmi/workflow.py
--- a/src/pyams_content/features/review/zmi/__init__.py	Wed Mar 07 14:46:15 2018 +0100
+++ b/src/pyams_content/features/review/zmi/__init__.py	Wed Mar 07 16:18:21 2018 +0100
@@ -120,6 +120,7 @@
             self.actions['review'].addClass('btn-primary')
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         manager = IReviewManager(self.context, None)
         if manager is not None:
             return manager.ask_review(data.get('reviewers'),
--- a/src/pyams_content/shared/common/zmi/__init__.py	Wed Mar 07 14:46:15 2018 +0100
+++ b/src/pyams_content/shared/common/zmi/__init__.py	Wed Mar 07 16:18:21 2018 +0100
@@ -298,6 +298,7 @@
             self.actions['duplicate'].addClass('btn-primary')
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         registry = self.request.registry
         # initialize new content
         content = get_parent(self.context, ISharedContent)
--- a/src/pyams_content/shared/common/zmi/owner.py	Wed Mar 07 14:46:15 2018 +0100
+++ b/src/pyams_content/shared/common/zmi/owner.py	Wed Mar 07 16:18:21 2018 +0100
@@ -95,6 +95,7 @@
             self.actions['change'].addClass('btn-primary')
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         new_owner = data.get('new_owner')
         workflow = IWorkflow(self.context)
         for version in IWorkflowVersions(self.context).get_versions():
--- a/src/pyams_content/shared/common/zmi/workflow.py	Wed Mar 07 14:46:15 2018 +0100
+++ b/src/pyams_content/shared/common/zmi/workflow.py	Wed Mar 07 16:18:21 2018 +0100
@@ -154,6 +154,7 @@
             self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         pub_info = IWorkflowPublicationInfo(self.context)
         pub_info.publication_effective_date = data.get('publication_effective_date')
         pub_info.push_end_date = data.get('push_end_date')
@@ -350,6 +351,7 @@
             self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         pub_info = IWorkflowPublicationInfo(self.context)
         pub_info.publication_effective_date = data.get('publication_effective_date')
         pub_info.push_end_date = data.get('push_end_date')
@@ -704,6 +706,7 @@
     ajax_handler = 'wf-clone.json'
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         info = IWorkflowInfo(self.context)
         return info.fire_transition_toward(DRAFT, comment=data.get('comment'))
 
@@ -780,6 +783,7 @@
                 self.actions['action'].title = _("Delete definitively")
 
     def createAndAdd(self, data):
+        data = data.get(self, data)
         state = IWorkflowState(self.context)
         if state.version_id == 1:  # remove the first and only version => remove all
             content = get_parent(self.context, ISharedContent)