Updated forms fields
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 May 2017 11:23:23 +0200
changeset 28 b10a699c5559
parent 27 ad5f7192d437
child 29 01a2ab1f4bd8
Updated forms fields
src/pyams_thesaurus/zmi/extract.py
--- a/src/pyams_thesaurus/zmi/extract.py	Tue May 16 11:23:05 2017 +0200
+++ b/src/pyams_thesaurus/zmi/extract.py	Tue May 16 11:23:23 2017 +0200
@@ -22,8 +22,8 @@
 from pyams_skin.layer import IPyAMSLayer
 from pyams_thesaurus.interfaces import ADMIN_THESAURUS_PERMISSION, MANAGE_THESAURUS_EXTRACT_PERMISSION
 from pyams_thesaurus.interfaces.thesaurus import IThesaurus, IThesaurusExtracts, IThesaurusExtractInfo, \
-    IThesaurusExtract
-from pyams_utils.interfaces import VIEW_PERMISSION
+    IThesaurusExtract, IThesaurusExtractRoles
+from pyams_utils.interfaces import VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION
 from pyams_utils.interfaces.data import IObjectData
 from pyams_utils.interfaces.tree import INode, ITree
 from pyams_zmi.layer import IAdminLayer
@@ -173,7 +173,7 @@
 
 
 @pagelet_config(name='properties.html', context=IThesaurusExtract, layer=IPyAMSLayer,
-                permission=MANAGE_THESAURUS_EXTRACT_PERMISSION)
+                permission=VIEW_SYSTEM_PERMISSION)
 class ThesaurusExtractEditForm(AdminDialogEditForm):
     """Thesaurus extract edit form"""
 
@@ -185,7 +185,8 @@
     legend = _("Edit extract properties")
     icon_css_class = 'fa fa-fw fa-filter'
 
-    fields = field.Fields(IThesaurusExtractInfo)
+    fields = field.Fields(IThesaurusExtractInfo) + \
+             field.Fields(IThesaurusExtractRoles)
 
     ajax_handler = 'properties.json'
     edit_permission = MANAGE_THESAURUS_EXTRACT_PERMISSION
@@ -208,7 +209,7 @@
     """Thesaurus extract edit form, AJAX view"""
 
     def get_ajax_output(self, changes):
-        extract_changes = changes.get(IThesaurusExtractInfo)
+        extract_changes = changes.get(IThesaurusExtractInfo, ())
         if ('name'in extract_changes) or ('color' in extract_changes):
             return {'status': 'reload'}
         else: