src/pyams_content/features/renderer/interfaces.py
changeset 1059 34e6d07ea2e9
parent 867 17c1149151aa
child 1068 71efa4864cce
equal deleted inserted replaced
1058:1fe028e17f70 1059:34e6d07ea2e9
       
     1 #
       
     2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 from zope.annotation import IAttributeAnnotatable
       
    20 from zope.contentprovider.interfaces import IContentProvider
       
    21 
       
    22 # import packages
       
    23 from zope.interface import Interface, Attribute
       
    24 
       
    25 
       
    26 HIDDEN_RENDERER_NAME = 'hidden'
       
    27 
       
    28 
       
    29 class IRenderedContent(IAttributeAnnotatable):
       
    30     """Generic interface for any rendered content"""
       
    31 
       
    32     renderer = Attribute("Selected renderer name")
       
    33 
       
    34     def get_renderer(self, request=None):
       
    35         """Get selected renderer implementation"""
       
    36 
       
    37 
       
    38 class IContentRenderer(IContentProvider):
       
    39     """Content renderer interface"""
       
    40 
       
    41     label = Attribute("Renderer label")
       
    42     weight = Attribute("Renderer weight, used for ordering")
       
    43 
       
    44     settings_interface = Attribute("Renderer settings interface")
       
    45     resources = Attribute("Iterable of needed Fanstatic resources")
       
    46 
       
    47     language = Attribute("Renderer language (if forced)")
       
    48     context_attrs = Attribute("Context attributes defined into renderer")
       
    49     i18n_context_attrs = Attribute("I18n context attributes defined into renderer")
       
    50 
       
    51 
       
    52 class ISharedContentRenderer(IContentRenderer):
       
    53     """Shared content renderer interface"""
       
    54 
       
    55 
       
    56 class IRendererSettings(Interface):
       
    57     """Base renderer settings interface"""