src/pyams_content/component/gallery/zmi/gallery.py
changeset 61 e5d6ea4dc839
parent 0 7c0001cacf8e
--- a/src/pyams_content/component/gallery/zmi/gallery.py	Tue Nov 15 09:47:14 2016 +0100
+++ b/src/pyams_content/component/gallery/zmi/gallery.py	Tue Nov 15 09:49:27 2016 +0100
@@ -83,7 +83,8 @@
 
     def updateWidgets(self, prefix=None):
         super(GalleryImageAddForm, self).updateWidgets(prefix)
-        self.widgets['author_comments'].label_css_class = 'textarea'
+        if 'author_comments' in self.widgets:
+            self.widgets['author_comments'].widget_css_class = 'textarea'
 
     def create(self, data):
         medias = []
@@ -195,9 +196,12 @@
 
     def updateWidgets(self, prefix=None):
         super(GalleryFilePropertiesEditForm, self).updateWidgets(prefix)
-        self.widgets['description'].label_css_class = 'textarea'
-        self.widgets['author_comments'].label_css_class = 'textarea'
-        self.widgets['sound_description'].label_css_class = 'textarea'
+        if 'description' in self.widgets:
+            self.widgets['description'].widget_css_class = 'textarea'
+        if 'author_comments' in self.widgets:
+            self.widgets['author_comments'].widget_css_class = 'textarea'
+        if 'sound_description' in self.widgets:
+            self.widgets['sound_description'].widget_css_class = 'textarea'
 
 
 @view_config(name='gallery-file-properties.json', context=IGalleryFile, request_type=IPyAMSLayer,