# HG changeset patch # User Thierry Florac # Date 1550231637 -3600 # Node ID 327666db65f922268541846b94f69417b28a61e1 # Parent 3e456248baf628b83eaf73ec977d13da2f523af4 Updated shared contents registration diff -r 3e456248baf6 -r 327666db65f9 src/pyams_content/shared/form/__init__.py --- a/src/pyams_content/shared/form/__init__.py Fri Feb 15 12:53:15 2019 +0100 +++ b/src/pyams_content/shared/form/__init__.py Fri Feb 15 12:53:57 2019 +0100 @@ -15,19 +15,19 @@ # import standard library -from zope.interface import implementer, provider, alsoProvides, noLongerProvides +from zope.interface import alsoProvides, implementer, noLongerProvides, provider from zope.schema.fieldproperty import FieldProperty from pyams_content import _ # import interfaces -from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE +from pyams_content.features.checker.interfaces import ERROR_VALUE, IContentChecker from pyams_content.features.preview.interfaces import IPreviewTarget from pyams_content.features.review.interfaces import IReviewTarget # import packages -from pyams_content.shared.common import WfSharedContent, SharedContent, register_content_type, WfSharedContentChecker, \ - IWfSharedContentFactory -from pyams_content.shared.form.interfaces import IWfForm, IForm, FORM_CONTENT_TYPE, FORM_CONTENT_NAME, \ - IFormFieldContainerTarget, IFormHandler, IFormFieldContainer, IWfFormFactory +from pyams_content.shared.common import IWfSharedContentFactory, SharedContent, WfSharedContent, WfSharedContentChecker, \ + register_content_type +from pyams_content.shared.form.interfaces import FORM_CONTENT_NAME, FORM_CONTENT_TYPE, IForm, IFormFieldContainer, \ + IFormFieldContainerTarget, IFormHandler, IWfForm, IWfFormFactory from pyams_utils.adapter import adapter_config from pyams_utils.registry import get_global_registry @@ -72,7 +72,8 @@ registry = get_global_registry() return registry.queryUtility(IFormHandler, name=handler) -register_content_type(WfForm) + +register_content_type(WfForm, shared_content=False) @provider(IWfFormFactory) diff -r 3e456248baf6 -r 327666db65f9 src/pyams_content/shared/imagemap/__init__.py --- a/src/pyams_content/shared/imagemap/__init__.py Fri Feb 15 12:53:15 2019 +0100 +++ b/src/pyams_content/shared/imagemap/__init__.py Fri Feb 15 12:53:57 2019 +0100 @@ -98,7 +98,7 @@ return IAssociationContainer(self).get(area.link) -register_content_type(WfImageMap) +register_content_type(WfImageMap, shared_content=False) @provider(IWfImageMapFactory) diff -r 3e456248baf6 -r 327666db65f9 src/pyams_content/shared/logo/__init__.py --- a/src/pyams_content/shared/logo/__init__.py Fri Feb 15 12:53:15 2019 +0100 +++ b/src/pyams_content/shared/logo/__init__.py Fri Feb 15 12:53:57 2019 +0100 @@ -15,6 +15,7 @@ from zope.interface import implementer, provider from zope.schema.fieldproperty import FieldProperty +from pyams_content import _ from pyams_content.component.links import InternalReferenceMixin from pyams_content.component.theme.interfaces import IThemesTarget from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE @@ -25,8 +26,6 @@ from pyams_file.property import FileProperty from pyams_utils.adapter import adapter_config -from pyams_content import _ - @implementer(IWfLogo, IThemesTarget, IReviewTarget) class WfLogo(WfSharedContent, InternalReferenceMixin): @@ -46,7 +45,7 @@ monochrome_image = FileProperty(IWfLogo['monochrome_image']) -register_content_type(WfLogo) +register_content_type(WfLogo, shared_content=False) @provider(IWfLogoFactory) diff -r 3e456248baf6 -r 327666db65f9 src/pyams_content/shared/view/__init__.py --- a/src/pyams_content/shared/view/__init__.py Fri Feb 15 12:53:15 2019 +0100 +++ b/src/pyams_content/shared/view/__init__.py Fri Feb 15 12:53:57 2019 +0100 @@ -18,7 +18,7 @@ from hypatia.catalog import CatalogQuery from hypatia.interfaces import ICatalog -from hypatia.query import Any, Gt, Lt, Eq +from hypatia.query import Any, Eq, Gt, Lt, Not from pyramid.events import subscriber from pyramid.threadlocal import get_current_registry from zope.interface import implementer, provider @@ -30,16 +30,16 @@ from pyams_catalog.query import CatalogResultSet, or_ from pyams_content.features.preview.interfaces import IPreviewTarget from pyams_content.features.review.interfaces import IReviewTarget -from pyams_content.shared.common import WfSharedContent, register_content_type, SharedContent, IWfSharedContentFactory, \ - IWfSharedContent +from pyams_content.shared.common import IGNORED_CONTENT_TYPES, IWfSharedContent, IWfSharedContentFactory, SharedContent, \ + WfSharedContent, register_content_type from pyams_content.shared.common.interfaces.types import IWfTypedSharedContent -from pyams_content.shared.view.interfaces import IView, IWfView, IWfViewFactory, IViewQuery, \ - IViewQueryParamsExtension, IViewQueryFilterExtension, VIEW_CONTENT_TYPE, VIEW_CONTENT_NAME, IViewSettings, \ - RELEVANCE_ORDER -from pyams_utils.adapter import adapter_config, ContextAdapter +from pyams_content.shared.view.interfaces import IView, IViewQuery, IViewQueryFilterExtension, \ + IViewQueryParamsExtension, IViewSettings, IWfView, IWfViewFactory, RELEVANCE_ORDER, VIEW_CONTENT_NAME, \ + VIEW_CONTENT_TYPE +from pyams_utils.adapter import ContextAdapter, adapter_config from pyams_utils.interfaces import ICacheKeyValue from pyams_utils.list import unique_iter -from pyams_utils.registry import get_utility, get_global_registry +from pyams_utils.registry import get_global_registry, get_utility from pyams_utils.timezone import tztime from pyams_workflow.interfaces import IWorkflow @@ -154,7 +154,7 @@ return (results, count) if get_count else results -register_content_type(WfView) +register_content_type(WfView, shared_content=False) @provider(IWfViewFactory) @@ -205,6 +205,7 @@ if content_path is not None: filters &= Eq(catalog['parents'], content_path) # check content types + filters &= Not(Any(catalog['content_type'], IGNORED_CONTENT_TYPES.keys())) content_types = view.get_content_types(context) if content_types: filters &= Any(catalog['content_type'], content_types) diff -r 3e456248baf6 -r 327666db65f9 src/pyams_content/shared/view/interfaces.py --- a/src/pyams_content/shared/view/interfaces.py Fri Feb 15 12:53:15 2019 +0100 +++ b/src/pyams_content/shared/view/interfaces.py Fri Feb 15 12:53:57 2019 +0100 @@ -19,8 +19,8 @@ from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary from pyams_content import _ -from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY, ISharedContent, ISharedTool, \ - IWfSharedContent +from pyams_content.shared.common.interfaces import ISharedContent, ISharedTool, IWfSharedContent, \ + SHARED_CONTENT_TYPES_VOCABULARY from pyams_content.shared.common.interfaces.types import ALL_DATA_TYPES_VOCABULARY from pyams_sequence.interfaces import IInternalReferencesList from pyams_sequence.schema import InternalReferencesListField @@ -88,7 +88,7 @@ selected_content_types = Set(title=_("Other content types"), description=_("Selected content types; leave empty for all"), - value_type=Choice(vocabulary=CONTENT_TYPES_VOCABULARY), + value_type=Choice(vocabulary=SHARED_CONTENT_TYPES_VOCABULARY), required=False) def get_content_types(self, context):