--- a/src/pyams_workflow/content.py Fri Jul 20 12:56:19 2018 +0200
+++ b/src/pyams_workflow/content.py Wed Jan 09 14:02:07 2019 +0100
@@ -12,35 +12,30 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
from datetime import datetime
-# import interfaces
+from persistent import Persistent
+from pyramid.events import subscriber
+from zope.container.contained import Contained
+from zope.dublincore.interfaces import IZopeDublinCore
+from zope.interface import implementer
+from zope.schema.fieldproperty import FieldProperty
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+
from pyams_security.interfaces import ISecurityManager
+from pyams_utils.adapter import adapter_config, get_annotation_adapter
+from pyams_utils.date import SH_DATE_FORMAT, format_date, format_datetime
from pyams_utils.interfaces import VIEW_PERMISSION
-from pyams_workflow.interfaces import IWorkflowManagedContent, IWorkflowPublicationInfo, IWorkflow, IWorkflowVersions, \
- IWorkflowPublicationSupport, IObjectClonedEvent, IWorkflowState, VersionError, VERSION_DISPLAY, \
- DISPLAY_FIRST_VERSION, DISPLAY_CURRENT_VERSION
-from zope.dublincore.interfaces import IZopeDublinCore
-
-# import packages
-from persistent import Persistent
-from pyams_utils.adapter import adapter_config, get_annotation_adapter
-from pyams_utils.date import format_datetime, format_date, SH_DATE_FORMAT
from pyams_utils.registry import get_utility
from pyams_utils.request import check_request
-from pyams_utils.timezone import gmtime, tztime, GMT
+from pyams_utils.timezone import GMT, gmtime, tztime
from pyams_utils.traversing import get_parent
from pyams_utils.vocabulary import vocabulary_config
+from pyams_workflow import _
+from pyams_workflow.interfaces import DISPLAY_CURRENT_VERSION, DISPLAY_FIRST_VERSION, IObjectClonedEvent, IWorkflow, \
+ IWorkflowManagedContent, IWorkflowPublicationInfo, IWorkflowPublicationSupport, IWorkflowState, IWorkflowVersions, \
+ VERSION_DISPLAY, VersionError
from pyams_workflow.versions import WorkflowHistoryItem
-from pyramid.events import subscriber
-from zope.container.contained import Contained
-from zope.interface import implementer
-from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-from pyams_workflow import _
@vocabulary_config(name='PyAMS content publication date')
@@ -147,9 +142,11 @@
def visible_publication_date(self):
displayed_date = self.displayed_publication_date
if displayed_date == DISPLAY_FIRST_VERSION:
- return self.first_publication_date
- else:
- return self.publication_date
+ state = IWorkflowState(self.__parent__)
+ if state.version_id > 1:
+ version = IWorkflowVersions(self.__parent__).get_version(1)
+ return IWorkflowPublicationInfo(version).publication_effective_date
+ return self.publication_effective_date
def reset(self, complete=True):
self._publication_date = None