# HG changeset patch # User Thierry Florac # Date 1528722012 -7200 # Node ID 0b5ec468c64b2738d28b835d998f33f4a3fb40c9 # Parent cf14f3928a90168f271e79cb8955c6d38d6c2b28 Added custom shared content portal page adapter diff -r cf14f3928a90 -r 0b5ec468c64b src/pyams_content/shared/common/portal.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/shared/common/portal.py Mon Jun 11 15:00:12 2018 +0200 @@ -0,0 +1,36 @@ +# +# Copyright (c) 2008-2018 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# + +__docformat__ = 'restructuredtext' + + +# import standard library + +# import interfaces +from pyams_content.shared.common.interfaces import IBaseSharedTool +from pyams_portal.interfaces import IPortalPage + +# import packages +from pyams_portal.page import PortalPage +from pyams_utils.traversing import get_parent + + +class SharedContentPortalPage(PortalPage): + """Shared content portal page""" + + @property + def can_inherit(self): + return IPortalPage(self.parent).template is not None + + @property + def parent(self): + return get_parent(self, IBaseSharedTool, allow_context=False)