Added portal context support
authorThierry Florac <thierry.florac@onf.fr>
Mon, 11 Jun 2018 15:22:01 +0200
changeset 618 3c48622a2937
parent 617 2e4dbe6fa156
child 619 95026785904d
Added portal context support
src/pyams_content/shared/blog/manager.py
src/pyams_content/shared/form/__init__.py
src/pyams_content/shared/form/manager.py
src/pyams_content/shared/site/folder.py
src/pyams_content/shared/site/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"""
 
--- 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"""
--- 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"""
 
--- 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"""
 
--- 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"""