src/pyams_content/interfaces/__init__.py
changeset 0 7c0001cacf8e
child 87 f382a0fb2375
equal deleted inserted replaced
-1:000000000000 0:7c0001cacf8e
       
     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.location.interfaces import IContained
       
    20 
       
    21 # import packages
       
    22 from pyams_i18n.schema import I18nTextLineField
       
    23 from zope.annotation.interfaces import IAttributeAnnotatable
       
    24 from zope.interface import Interface
       
    25 from zope.schema import Datetime, TextLine
       
    26 
       
    27 from pyams_content import _
       
    28 
       
    29 
       
    30 #
       
    31 # Custom permissions
       
    32 #
       
    33 
       
    34 MANAGE_SITE_ROOT_PERMISSION = 'pyams.ManageSiteRoot'
       
    35 MANAGE_SITE_PERMISSION = 'pyams.ManageSite'
       
    36 MANAGE_TOOL_PERMISSION = 'pyams.ManageTool'
       
    37 CREATE_CONTENT_PERMISSION = 'pyams.CreateContent'
       
    38 MANAGE_CONTENT_PERMISSION = 'pyams.ManageContent'
       
    39 COMMENT_CONTENT_PERMISSION = 'pyams.CommentContent'
       
    40 PUBLISH_CONTENT_PERMISSION = 'pyams.PublishContent'
       
    41 
       
    42 
       
    43 #
       
    44 # Base content interfaces
       
    45 #
       
    46 
       
    47 class IBaseContent(IContained, IAttributeAnnotatable):
       
    48     """Base content interface"""
       
    49 
       
    50     __name__ = TextLine(title=_("Unique key"),
       
    51                         description=_("WARNING: this key can't be modified after creation!!!"),
       
    52                         required=True)
       
    53 
       
    54     title = I18nTextLineField(title=_("Title"),
       
    55                               description=_("Visible label used to display content"),
       
    56                               required=True)
       
    57 
       
    58     short_name = I18nTextLineField(title=_("Short name"),
       
    59                                    description=_("Short name used in breadcrumbs"),
       
    60                                    required=True)
       
    61 
       
    62 
       
    63 class IBaseContentInfo(Interface):
       
    64     """Base content info interface"""
       
    65 
       
    66     created_date = Datetime(title=_("Creation date"),
       
    67                             required=False,
       
    68                             readonly=True)
       
    69 
       
    70     modified_date = Datetime(title=_("Modification date"),
       
    71                              required=False,
       
    72                              readonly=False)