Imports cleanup and updated JSON response
authorThierry Florac <thierry.florac@onf.fr>
Fri, 13 Oct 2017 08:33:53 +0200
changeset 218 f9744fecbb23
parent 217 57b690463135
child 219 fa51a3ae17a1
Imports cleanup and updated JSON response
src/pyams_content/component/paragraph/zmi/video.py
--- a/src/pyams_content/component/paragraph/zmi/video.py	Fri Oct 13 08:30:54 2017 +0200
+++ b/src/pyams_content/component/paragraph/zmi/video.py	Fri Oct 13 08:33:53 2017 +0200
@@ -9,35 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyramid.view import view_config
-from transaction.interfaces import ITransactionManager
-
-from pyams_content.component.association.zmi import AssociationsTable
-from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
-    IParagraphSummary
-from pyams_content.component.paragraph.interfaces.video import IVideoParagraph
-from pyams_content.component.paragraph.video import VideoParagraph
-from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu
-from pyams_content.component.paragraph.zmi.container import ParagraphContainerView
-from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
-from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_form.group import NamedWidgetsGroup
-from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
-from pyams_form.security import ProtectedFormObjectMixin
-from pyams_i18n.interfaces import II18n
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
-from pyams_skin.layer import IPyAMSLayer
-from pyams_skin.viewlet.toolbar import ToolbarMenuItem
-from pyams_template.template import template_config
-from pyams_utils.adapter import adapter_config
-from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
-from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
-from pyams_zmi.interfaces import IPropertiesEditForm
 
 __docformat__ = 'restructuredtext'
 
@@ -45,9 +16,35 @@
 # import standard library
 
 # import interfaces
+from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
+    IParagraphSummary
+from pyams_content.component.paragraph.interfaces.video import IVideoParagraph
+from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
+from pyams_content.shared.common.interfaces import IWfSharedContent
+from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
+from pyams_i18n.interfaces import II18n
+from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
+from pyams_skin.layer import IPyAMSLayer
+from pyams_zmi.interfaces import IPropertiesEditForm
+from transaction.interfaces import ITransactionManager
 from z3c.form.interfaces import INPUT_MODE
 
 # import packages
+from pyams_content.component.association.zmi import AssociationsTable
+from pyams_content.component.paragraph.video import VideoParagraph
+from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
+    BaseParagraphAddMenu
+from pyams_content.component.paragraph.zmi.container import ParagraphContainerView
+from pyams_form.group import NamedWidgetsGroup
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+from pyams_utils.traversing import get_parent
+from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider
+from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
+from pyramid.view import view_config
 from z3c.form import field, button
 from zope.interface import implementer
 
@@ -155,7 +152,7 @@
             associations_table.update()
             output.setdefault('events', []).append({
                 'event': 'PyAMS_content.changed_item',
-                'options': {'object_type': 'associations',
+                'options': {'handler': 'PyAMS_content.associations.refreshAssociations',
                             'object_name': associations_table.id,
                             'table': associations_table.render()}})
         return output
@@ -190,7 +187,7 @@
             associations_table.update()
             output.setdefault('events', []).append({
                 'event': 'PyAMS_content.changed_item',
-                'options': {'object_type': 'associations',
+                'options': {'handler': 'PyAMS_content.associations.refreshAssociations',
                             'object_name': associations_table.id,
                             'table': associations_table.render()}
             })
@@ -201,7 +198,7 @@
             form.update()
             output.setdefault('events', []).append({
                 'event': 'PyAMS_content.changed_item',
-                'options': {'object_type': 'form',
+                'options': {'handler': 'PyAMS_content.refreshForm',
                             'object_name': '{0}_{1}_{2}'.format(
                                 self.context.__class__.__name__,
                                 getattr(form.getContent(), '__name__', 'noname').replace('++', ''),