Added check on form widgets
authorThierry Florac <thierry.florac@onf.fr>
Tue, 27 Jun 2017 11:46:27 +0200
changeset 90 740542deeb04
parent 89 4e593a05b02d
child 91 87e08c0f3e3c
Added check on form widgets
src/pyams_content/component/theme/zmi/manager.py
--- a/src/pyams_content/component/theme/zmi/manager.py	Tue Jun 27 11:46:00 2017 +0200
+++ b/src/pyams_content/component/theme/zmi/manager.py	Tue Jun 27 11:46:27 2017 +0200
@@ -61,13 +61,14 @@
 
     def updateWidgets(self, prefix=None):
         super(ThemesManagerEditForm, self).updateWidgets(prefix)
-        widget = self.widgets['extract_name']
-        widget.object_data = {'ams-plugins': 'pyams_content',
-                              'ams-plugin-pyams_content-src':
-                                  '/--static--/pyams_content/js/pyams_content{MyAMS.devext}.js',
-                              'ams-plugin-pyams_content-callback': 'PyAMS_content.themes.initExtracts',
-                              'ams-plugin-pyams_content-async': 'false'}
-        alsoProvides(widget, IObjectData)
+        if 'extract_name' in self.widgets:
+            widget = self.widgets['extract_name']
+            widget.object_data = {'ams-plugins': 'pyams_content',
+                                  'ams-plugin-pyams_content-src':
+                                      '/--static--/pyams_content/js/pyams_content{MyAMS.devext}.js',
+                                  'ams-plugin-pyams_content-callback': 'PyAMS_content.themes.initExtracts',
+                                  'ams-plugin-pyams_content-async': 'false'}
+            alsoProvides(widget, IObjectData)
 
 
 @view_config(name='themes.json', context=IThemesManagerTarget, request_type=IPyAMSLayer,