Added field_names attribute to typed shared content
authorThierry Florac <thierry.florac@onf.fr>
Fri, 05 Oct 2018 15:00:26 +0200
changeset 996 91cd0cc00ab5
parent 995 a219e2e20779
child 997 38c23b8cc9e3
Added field_names attribute to typed shared content
src/pyams_content/shared/common/interfaces/types.py
src/pyams_content/shared/common/types.py
--- a/src/pyams_content/shared/common/interfaces/types.py	Wed Oct 03 19:24:39 2018 +0200
+++ b/src/pyams_content/shared/common/interfaces/types.py	Fri Oct 05 15:00:26 2018 +0200
@@ -130,6 +130,8 @@
     def get_data_type(self):
         """Get associated data type"""
 
+    field_names = Attribute("Selected data type field names")
+
 
 class IWfTypedSharedContentPortalContext(IWfTypedSharedContent, IBaseContentPortalContext):
     """Shared content with portal support"""
--- a/src/pyams_content/shared/common/types.py	Wed Oct 03 19:24:39 2018 +0200
+++ b/src/pyams_content/shared/common/types.py	Fri Oct 05 15:00:26 2018 +0200
@@ -133,6 +133,12 @@
             manager = ITypedDataManager(tool)
             return manager.get(self.data_type)
 
+    @property
+    def field_names(self):
+        data_type = self.get_data_type()
+        if data_type is not None:
+            return data_type.field_names
+
 
 @subscriber(IObjectAddedEvent, context_selector=IWfTypedSharedContent)
 def handle_added_typed_shared_content(event):