# HG changeset patch # User Thierry Florac # Date 1528723321 -7200 # Node ID 3c48622a2937aa3a73d38cd8f8bb03a027ebef72 # Parent 2e4dbe6fa156b201b0dcc2338e1e8cb871cd9d62 Added portal context support diff -r 2e4dbe6fa156 -r 3c48622a2937 src/pyams_content/shared/blog/manager.py --- a/src/pyams_content/shared/blog/manager.py Mon Jun 11 15:18:58 2018 +0200 +++ b/src/pyams_content/shared/blog/manager.py Mon Jun 11 15:22:01 2018 +0200 @@ -27,7 +27,6 @@ from pyams_content.shared.blog.interfaces import IBlogManager, IBlogFolder, IBlogFolderFactory, IBlogManagerFactory from pyams_content.shared.common.interfaces import ISharedContentFactory from pyams_portal.interfaces import IPortalContext -from zope.annotation.interfaces import IAttributeAnnotatable from zope.component.interfaces import ISite from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectRemovedEvent @@ -55,7 +54,7 @@ @implementer(IBlogManager, IParagraphFactorySettings, IThemesManagerTarget, IPictogramManagerTarget, - IIllustrationTarget, IPortalContext, IHeaderTarget, IFooterTarget, IPreviewTarget, IAttributeAnnotatable) + IIllustrationTarget, IHeaderTarget, IFooterTarget, IPortalContext, IPreviewTarget) class BlogManager(Folder, BaseSharedTool, UserSkinnableContent): """Nlog manager class""" diff -r 2e4dbe6fa156 -r 3c48622a2937 src/pyams_content/shared/form/__init__.py --- a/src/pyams_content/shared/form/__init__.py Mon Jun 11 15:18:58 2018 +0200 +++ b/src/pyams_content/shared/form/__init__.py Mon Jun 11 15:22:01 2018 +0200 @@ -21,11 +21,13 @@ from pyams_content.features.review.interfaces import IReviewTarget from pyams_content.shared.form.interfaces import IWfForm, IForm, FORM_CONTENT_TYPE, FORM_CONTENT_NAME, \ IFormFieldContainerTarget, IFormHandler, IFormFieldContainer, IWfFormFactory +from pyams_portal.interfaces import IPortalPage, PORTAL_PAGE_KEY, IPortalContext # import packages from pyams_content.shared.common import WfSharedContent, SharedContent, register_content_type, WfSharedContentChecker, \ IWfSharedContentFactory -from pyams_utils.adapter import adapter_config +from pyams_content.shared.common.portal import SharedContentPortalPage +from pyams_utils.adapter import adapter_config, get_annotation_adapter from pyams_utils.registry import get_global_registry from zope.interface import implementer, provider, alsoProvides, noLongerProvides from zope.schema.fieldproperty import FieldProperty @@ -34,7 +36,7 @@ @implementer(IWfForm, IFormFieldContainerTarget, - IPreviewTarget, IReviewTarget) + IPortalContext, IPreviewTarget, IReviewTarget) class WfForm(WfSharedContent): """Base form""" @@ -88,6 +90,12 @@ return WfForm +@adapter_config(context=IWfForm, provides=IPortalPage) +def form_portal_page_adapter(context): + """Form portal page adapter""" + return get_annotation_adapter(context, PORTAL_PAGE_KEY, SharedContentPortalPage) + + @adapter_config(name='properties', context=IWfForm, provides=IContentChecker) class WfFormContentChecker(WfSharedContentChecker): """Form content checker""" diff -r 2e4dbe6fa156 -r 3c48622a2937 src/pyams_content/shared/form/manager.py --- a/src/pyams_content/shared/form/manager.py Mon Jun 11 15:18:58 2018 +0200 +++ b/src/pyams_content/shared/form/manager.py Mon Jun 11 15:22:01 2018 +0200 @@ -18,7 +18,7 @@ # import interfaces from pyams_content.shared.common.interfaces import ISharedContentFactory from pyams_content.shared.form.interfaces import IFormsManager, FORM_CONTENT_TYPE, IFormsManagerFactory -from zope.annotation.interfaces import IAttributeAnnotatable +from pyams_portal.interfaces import IPortalContext from zope.component.interfaces import ISite from zope.lifecycleevent.interfaces import IObjectAddedEvent @@ -32,7 +32,7 @@ from zope.interface import implementer -@implementer(IFormsManager, IAttributeAnnotatable) +@implementer(IFormsManager, IPortalContext) class FormsManager(SharedTool): """Forms manager class""" diff -r 2e4dbe6fa156 -r 3c48622a2937 src/pyams_content/shared/site/folder.py --- a/src/pyams_content/shared/site/folder.py Mon Jun 11 15:18:58 2018 +0200 +++ b/src/pyams_content/shared/site/folder.py Mon Jun 11 15:22:01 2018 +0200 @@ -24,7 +24,6 @@ from pyams_i18n.interfaces import II18n from pyams_portal.interfaces import IPortalContext from pyams_security.interfaces import IDefaultProtectionPolicy -from zope.annotation.interfaces import IAttributeAnnotatable from zope.intid.interfaces import IIntIds # import packages @@ -45,7 +44,7 @@ @implementer(IDefaultProtectionPolicy, ISiteFolder, ISiteFolderRoles, - IIllustrationTarget, IPortalContext, IPreviewTarget, IAttributeAnnotatable) + IIllustrationTarget, IPortalContext, IPreviewTarget) class SiteFolder(SiteContainerMixin, OrderedContainer, BaseSharedTool): """Site folder persistent class""" diff -r 2e4dbe6fa156 -r 3c48622a2937 src/pyams_content/shared/site/manager.py --- a/src/pyams_content/shared/site/manager.py Mon Jun 11 15:18:58 2018 +0200 +++ b/src/pyams_content/shared/site/manager.py Mon Jun 11 15:22:01 2018 +0200 @@ -30,7 +30,6 @@ from pyams_form.interfaces.form import IFormContextPermissionChecker from pyams_i18n.interfaces import II18n from pyams_portal.interfaces import IPortalContext -from zope.annotation.interfaces import IAttributeAnnotatable from zope.component.interfaces import ISite from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectRemovedEvent @@ -53,7 +52,7 @@ @implementer(ISiteManager, IParagraphFactorySettings, IThemesManagerTarget, IPictogramManagerTarget, - IIllustrationTarget, IPortalContext, IHeaderTarget, IFooterTarget, IPreviewTarget, IAttributeAnnotatable) + IIllustrationTarget, IPortalContext, IHeaderTarget, IFooterTarget, IPreviewTarget) class SiteManager(SiteContainerMixin, OrderedContainer, BaseSharedTool, UserSkinnableContent): """Site manager persistent class"""