Use workflow visible states instead of published states
authorThierry Florac <thierry.florac@onf.fr>
Thu, 10 Jan 2019 17:45:06 +0100
changeset 366 4c4b26c3972a
parent 365 03631bacc240
child 367 d963400cf7cf
Use workflow visible states instead of published states
src/pyams_default_theme/component/illustration/__init__.py
src/pyams_default_theme/features/sitemap/__init__.py
src/pyams_default_theme/routes.py
src/pyams_default_theme/shared/common/navigation.py
src/pyams_default_theme/shared/common/oid.py
src/pyams_default_theme/shared/common/summary.py
--- a/src/pyams_default_theme/component/illustration/__init__.py	Wed Jan 09 15:44:26 2019 +0100
+++ b/src/pyams_default_theme/component/illustration/__init__.py	Thu Jan 10 17:45:06 2019 +0100
@@ -79,7 +79,7 @@
 @adapter_config(context=(ISharedContent, IPyAMSLayer), provides=IContentNavigationIllustration)
 def shared_content_illustration_factory(context, request):
     """Shared content illustration factory"""
-    version = context.published_version
+    version = context.visible_version
     if version is not None:
         return request.registry.queryMultiAdapter((version, request), IContentNavigationIllustration)
 
--- a/src/pyams_default_theme/features/sitemap/__init__.py	Wed Jan 09 15:44:26 2019 +0100
+++ b/src/pyams_default_theme/features/sitemap/__init__.py	Thu Jan 10 17:45:06 2019 +0100
@@ -100,6 +100,6 @@
         workflow = IWorkflow(context)
         params = Eq(catalog['parents'], intids.register(context)) & \
                  Any(catalog['content_type'], CONTENT_TYPES.keys()) & \
-                 Any(catalog['workflow_state'], workflow.published_states)
+                 Any(catalog['workflow_state'], workflow.visible_states)
         for version in unique_iter(CatalogResultSet(CatalogQuery(catalog).query(params))):
             yield from product(II18nManager(version).get_languages(), (version,))
--- a/src/pyams_default_theme/routes.py	Wed Jan 09 15:44:26 2019 +0100
+++ b/src/pyams_default_theme/routes.py	Thu Jan 10 17:45:06 2019 +0100
@@ -43,7 +43,7 @@
             if workflow is not None:
                 versions = IWorkflowVersions(target, None)
                 if versions is not None:
-                    versions = versions.get_versions(workflow.published_states, sort=True)
+                    versions = versions.get_versions(workflow.visible_states, sort=True)
                     if versions:
                         target = versions[-1]
         if (target is not None) and not IWorkflowPublicationInfo(target).is_visible(request):
--- a/src/pyams_default_theme/shared/common/navigation.py	Wed Jan 09 15:44:26 2019 +0100
+++ b/src/pyams_default_theme/shared/common/navigation.py	Thu Jan 10 17:45:06 2019 +0100
@@ -49,6 +49,6 @@
 
     @property
     def visible(self):
-        version = self.context.published_version
+        version = self.context.visible_version
         if version is not None:
             return IWorkflowPublicationInfo(version).is_visible(self.request)
--- a/src/pyams_default_theme/shared/common/oid.py	Wed Jan 09 15:44:26 2019 +0100
+++ b/src/pyams_default_theme/shared/common/oid.py	Thu Jan 10 17:45:06 2019 +0100
@@ -49,7 +49,7 @@
             if workflow is not None:
                 versions = IWorkflowVersions(target, None)
                 if versions is not None:
-                    versions = versions.get_versions(workflow.published_states, sort=True)
+                    versions = versions.get_versions(workflow.visible_states, sort=True)
                     if versions:
                         target = versions[-1]
         if (target is not None) and not IWorkflowPublicationInfo(target).is_visible(self.request):
--- a/src/pyams_default_theme/shared/common/summary.py	Wed Jan 09 15:44:26 2019 +0100
+++ b/src/pyams_default_theme/shared/common/summary.py	Thu Jan 10 17:45:06 2019 +0100
@@ -41,6 +41,6 @@
 @adapter_config(context=(ISharedContent, IPyAMSUserLayer), provides=IContentSummaryInfo)
 def shared_content_summary_adapter(context, request):
     """Shared content summary adapter"""
-    version = context.published_version
+    version = context.visible_version
     if version is not None:
         return request.registry.queryMultiAdapter((version, request), IContentSummaryInfo)