Added workflow states vocabulary name to package interface
authorThierry Florac <tflorac@ulthar.net>
Fri, 24 May 2019 08:58:06 +0200
changeset 1319 e72aa60c1e4d
parent 1318 bab66a5a7d2f
child 1320 ec425b5dfd57
Added workflow states vocabulary name to package interface
src/pyams_content/shared/common/interfaces/__init__.py
src/pyams_content/shared/common/zmi/search.py
src/pyams_content/shared/common/zmi/types/updater.py
--- a/src/pyams_content/shared/common/interfaces/__init__.py	Thu May 23 18:02:13 2019 +0200
+++ b/src/pyams_content/shared/common/interfaces/__init__.py	Fri May 24 08:58:06 2019 +0200
@@ -92,6 +92,9 @@
                                      default="PyAMS default workflow")
 
 
+SHARED_TOOL_WORKFLOW_STATES_VOCABULARY = 'PyAMS workflow states'
+
+
 class ISharedTool(IBaseSharedTool):
     """Shared tool interface"""
 
--- a/src/pyams_content/shared/common/zmi/search.py	Thu May 23 18:02:13 2019 +0200
+++ b/src/pyams_content/shared/common/zmi/search.py	Fri May 24 08:58:06 2019 +0200
@@ -28,7 +28,7 @@
     IThemesManager, IThemesManagerTarget
 from pyams_content.profile.interfaces import IAdminProfile
 from pyams_content.shared.common import CONTENT_TYPES
-from pyams_content.shared.common.interfaces import IBaseSharedTool
+from pyams_content.shared.common.interfaces import IBaseSharedTool, SHARED_TOOL_WORKFLOW_STATES_VOCABULARY
 from pyams_content.shared.common.interfaces.zmi import ISharedToolDashboardTable
 from pyams_content.zmi.interfaces import IAllContentsMenu
 from pyams_form.search import ISearchFields, SearchForm, SearchResultsView, SearchView
@@ -144,7 +144,7 @@
 # Advanced search views
 #
 
-@vocabulary_config(name='PyAMS workflow states')
+@vocabulary_config(name=SHARED_TOOL_WORKFLOW_STATES_VOCABULARY)
 def WorkflowStatesVocabulary(context):
     """Workflow states vocabulary"""
     target = get_parent(context, IBaseSharedTool)
@@ -170,7 +170,7 @@
                       required=False)
 
     status = Choice(title=_("Status"),
-                    vocabulary='PyAMS workflow states',
+                    vocabulary=SHARED_TOOL_WORKFLOW_STATES_VOCABULARY,
                     required=False)
 
     created_after = Datetime(title=_("Created after..."),
--- a/src/pyams_content/shared/common/zmi/types/updater.py	Thu May 23 18:02:13 2019 +0200
+++ b/src/pyams_content/shared/common/zmi/types/updater.py	Fri May 24 08:58:06 2019 +0200
@@ -25,6 +25,7 @@
 from pyams_catalog.query import CatalogResultSet
 from pyams_content.interfaces import MANAGE_TOOL_PERMISSION
 from pyams_content.shared.common import CONTENT_TYPES
+from pyams_content.shared.common.interfaces import SHARED_TOOL_WORKFLOW_STATES_VOCABULARY
 from pyams_content.shared.common.interfaces.types import DATA_TYPES_VOCABULARY, ITypedSharedTool
 from pyams_content.shared.common.zmi.types import TypedSharedToolTypesView
 from pyams_form.form import AJAXAddForm, ajax_config
@@ -71,7 +72,7 @@
 
     source_status = Choice(title=_("Source status"),
                            description=_("Current status to be updated"),
-                           vocabulary='PyAMS workflow states',
+                           vocabulary=SHARED_TOOL_WORKFLOW_STATES_VOCABULARY,
                            required=False)
 
     ignore_archives = Bool(title=_("Ignore archives?"),
@@ -103,9 +104,7 @@
 
     @property
     def fields(self):
-        workflow = IWorkflow(self.context)
         fields = field.Fields(ITypedSharedToolDatatypeUpdateInfo)
-        fields['source_status'].vocabulary = workflow.states
         fields['ignore_archives'].widgetFactory = SingleCheckBoxFieldWidget
         return fields