Added edit forms prefix
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Apr 2018 11:32:22 +0200
changeset 86 d3033257c8e5
parent 85 bd438ff8acb7
child 87 0da5847db3a4
Added edit forms prefix
src/pyams_media/zmi/__init__.py
src/pyams_media/zmi/media.py
--- a/src/pyams_media/zmi/__init__.py	Wed Apr 11 11:32:07 2018 +0200
+++ b/src/pyams_media/zmi/__init__.py	Wed Apr 11 11:32:22 2018 +0200
@@ -46,6 +46,8 @@
 class MediaConversionUtilityPropertiesEditForm(AdminDialogEditForm):
     """Medias conversion utility properties edit form"""
 
+    prefix = 'converter_properties.'
+
     @property
     def title(self):
         return self.context.__name__
@@ -66,7 +68,8 @@
 class MediaVideoConversionPropertiesEditForm(InnerAdminEditForm):
     """Video conversion utility properties edit form"""
 
-    id = 'video_properties'
+    prefix = 'video_properties.'
+
     tab_label = _("Video conversion")
     legend = None
     fields = field.Fields(IMediaConversionUtility).select('video_formats', 'video_frame_size',
@@ -84,7 +87,8 @@
 class MediaAudioConversionPropertiesEditForm(InnerAdminEditForm):
     """Audio conversion utility properties edit form"""
 
-    id = 'audio_properties'
+    prefix = 'audio_properties.'
+
     tab_label = _("Audio conversion")
     legend = None
     fields = field.Fields(IMediaConversionUtility).select('audio_formats', 'audio_sampling', 'audio_bitrate')
@@ -165,10 +169,14 @@
     def get_ajax_output(self, changes):
         status, message = changes
         if status == 200:
-            return {'status': 'success',
-                    'content': {'html': text_to_html(message)},
-                    'close_form': False}
+            return {
+                'status': 'success',
+                'content': {'html': text_to_html(message)},
+                'close_form': False
+            }
         else:
-            return {'status': 'info',
-                    'content': {'html': text_to_html(message)},
-                    'close_form': False}
+            return {
+                'status': 'info',
+                'content': {'html': text_to_html(message)},
+                'close_form': False
+            }
--- a/src/pyams_media/zmi/media.py	Wed Apr 11 11:32:07 2018 +0200
+++ b/src/pyams_media/zmi/media.py	Wed Apr 11 11:32:22 2018 +0200
@@ -85,6 +85,8 @@
 class VideoConversionsEditForm(AdminDialogEditForm):
     """Video conversions display form"""
 
+    prefix = 'video_conversion.'
+
     legend = _("Selected video conversions")
     icon_css_class = 'fa fa-fw fa-compress'
 
@@ -118,8 +120,10 @@
     """Video conversions edit form, JSON renderer"""
 
     def get_ajax_output(self, changes):
-        return {'status': 'success',
-                'message': self.request.localizer.translate(_("Media conversions restarted!"))}
+        return {
+            'status': 'success',
+            'message': self.request.localizer.translate(_("Media conversions restarted!"))
+        }
 
 
 @viewlet_config(name='video-conversions-prefix', context=IVideo, layer=IAdminLayer,
@@ -182,6 +186,8 @@
 class AudioConversionsEditForm(AdminDialogEditForm):
     """Audio conversions display form"""
 
+    prefix = 'audio_conversions.'
+
     legend = _("Selected audio conversions")
     icon_css_class = 'fa fa-fw fa-compress'
 
@@ -215,8 +221,10 @@
     """Audio conversions edit form, JSON renderer"""
 
     def get_ajax_output(self, changes):
-        return {'status': 'success',
-                'message': self.request.localizer.translate(_("Media conversions restarted!"))}
+        return {
+            'status': 'success',
+            'message': self.request.localizer.translate(_("Media conversions restarted!"))
+        }
 
 
 @viewlet_config(name='audio-conversions-prefix', context=IAudio, layer=IAdminLayer,