src/pyams_content/interfaces/__init__.py
changeset 0 7c0001cacf8e
child 87 f382a0fb2375
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/interfaces/__init__.py	Thu Oct 08 13:37:29 2015 +0200
@@ -0,0 +1,72 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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 zope.location.interfaces import IContained
+
+# import packages
+from pyams_i18n.schema import I18nTextLineField
+from zope.annotation.interfaces import IAttributeAnnotatable
+from zope.interface import Interface
+from zope.schema import Datetime, TextLine
+
+from pyams_content import _
+
+
+#
+# Custom permissions
+#
+
+MANAGE_SITE_ROOT_PERMISSION = 'pyams.ManageSiteRoot'
+MANAGE_SITE_PERMISSION = 'pyams.ManageSite'
+MANAGE_TOOL_PERMISSION = 'pyams.ManageTool'
+CREATE_CONTENT_PERMISSION = 'pyams.CreateContent'
+MANAGE_CONTENT_PERMISSION = 'pyams.ManageContent'
+COMMENT_CONTENT_PERMISSION = 'pyams.CommentContent'
+PUBLISH_CONTENT_PERMISSION = 'pyams.PublishContent'
+
+
+#
+# Base content interfaces
+#
+
+class IBaseContent(IContained, IAttributeAnnotatable):
+    """Base content interface"""
+
+    __name__ = TextLine(title=_("Unique key"),
+                        description=_("WARNING: this key can't be modified after creation!!!"),
+                        required=True)
+
+    title = I18nTextLineField(title=_("Title"),
+                              description=_("Visible label used to display content"),
+                              required=True)
+
+    short_name = I18nTextLineField(title=_("Short name"),
+                                   description=_("Short name used in breadcrumbs"),
+                                   required=True)
+
+
+class IBaseContentInfo(Interface):
+    """Base content info interface"""
+
+    created_date = Datetime(title=_("Creation date"),
+                            required=False,
+                            readonly=True)
+
+    modified_date = Datetime(title=_("Modification date"),
+                             required=False,
+                             readonly=False)