src/pyams_viewlet/interfaces/__init__.py
changeset 29 6ab01534cc92
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_viewlet/interfaces/__init__.py	Wed Dec 05 13:23:08 2018 +0100
@@ -0,0 +1,57 @@
+#
+# 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.contentprovider.interfaces import IContentProvider
+from zope.interface.common.mapping import IReadMapping
+
+# import packages
+from zope.interface import Attribute
+
+
+class IViewlet(IContentProvider):
+    """A content provider that is managed by another content provider, known
+    as viewlet manager.
+
+    Note that you *cannot* call viewlets directly as a provider, i.e. through
+    the TALES ``provider`` expression, since it always has to know its manager.
+    """
+
+    manager = Attribute("""The Viewlet Manager
+
+                        The viewlet manager for which the viewlet is registered. The viewlet
+                        manager will contain any additional data that was provided by the
+                        view, for example the TAL namespace attributes.
+                        """)
+
+
+class IViewletManager(IContentProvider, IReadMapping):
+    """A component that provides access to the content providers.
+
+    The viewlet manager's responsibilities are:
+
+      (1) Aggregation of all viewlets registered for the manager.
+
+      (2) Apply a set of filters to determine the availability of the
+          viewlets.
+
+      (3) Sort the viewlets based on some implemented policy.
+
+      (4) Provide an environment in which the viewlets are rendered.
+
+      (5) Render itself containing the HTML content of the viewlets.
+    """