--- a/src/pyams_content/shared/news/__init__.py Wed Jul 12 11:54:43 2017 +0200
+++ b/src/pyams_content/shared/news/__init__.py Wed Jul 12 11:55:25 2017 +0200
@@ -21,48 +21,11 @@
from pyams_content.component.links.interfaces import ILinkContainerTarget
from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget
from pyams_content.component.theme.interfaces import IThemesTarget
-from pyams_content.shared.news.interfaces import INewsEvent, IWfNewsEvent, NEWS_CONTENT_TYPE, NEWS_CONTENT_NAME, \
- DISPLAY_FIRST_VERSION, DISPLAY_CURRENT_VERSION, VERSION_DISPLAY
-from pyams_workflow.interfaces import IWorkflowVersions, VersionError, IWorkflowPublicationInfo
+from pyams_content.shared.news.interfaces import INewsEvent, IWfNewsEvent, NEWS_CONTENT_TYPE, NEWS_CONTENT_NAME
# import packages
from pyams_content.shared.common import SharedContent, WfSharedContent, register_content_type
-from pyams_utils.date import format_date
-from pyams_utils.request import check_request
-from pyams_utils.vocabulary import vocabulary_config
from zope.interface import implementer
-from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-
-@vocabulary_config(name='PyAMS news publication date')
-class WfNewsDisplayedDateVocabulary(SimpleVocabulary):
- """Base news event vocabulary"""
-
- def __init__(self, context):
- request = check_request()
- terms = []
- versions = IWorkflowVersions(context)
- # check for current version
- first_version_label = request.localizer.translate(VERSION_DISPLAY[DISPLAY_FIRST_VERSION])
- try:
- first_version = versions.get_version(1)
- except VersionError:
- pass
- else:
- info = IWorkflowPublicationInfo(first_version, None)
- if info is not None and info.publication_effective_date:
- first_version_label = '{0} ({1})'.format(first_version_label,
- format_date(info.publication_effective_date))
- terms.append(SimpleTerm(DISPLAY_FIRST_VERSION, title=first_version_label))
- # check for current version
- current_version_label = request.localizer.translate(VERSION_DISPLAY[DISPLAY_CURRENT_VERSION])
- info = IWorkflowPublicationInfo(context, None)
- if info is not None and info.publication_effective_date:
- current_version_label = '{0} ({1})'.format(current_version_label,
- format_date(info.publication_effective_date))
- terms.append(SimpleTerm(DISPLAY_CURRENT_VERSION, title=current_version_label))
- super(WfNewsDisplayedDateVocabulary, self).__init__(terms)
@implementer(IWfNewsEvent, IParagraphContainerTarget, IThemesTarget, IExtFileContainerTarget, ILinkContainerTarget,
@@ -73,9 +36,6 @@
content_type = NEWS_CONTENT_TYPE
content_name = NEWS_CONTENT_NAME
- displayed_publication_date = FieldProperty(IWfNewsEvent['displayed_publication_date'])
- push_end_date = FieldProperty(IWfNewsEvent['push_end_date'])
-
register_content_type(WfNewsEvent)