|
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 """PyAMS_pagelet.interfaces module |
|
14 |
|
15 """ |
|
16 |
|
17 from pyramid.interfaces import IView |
|
18 from zope.contentprovider.interfaces import IContentProvider |
|
19 from zope.interface import Attribute, implementer |
|
20 from zope.interface.interfaces import IObjectEvent, ObjectEvent |
|
21 |
|
22 |
|
23 __docformat__ = 'restructuredtext' |
|
24 |
|
25 |
|
26 class IPagelet(IView): |
|
27 """Pagelet interface""" |
|
28 |
|
29 def update(self): |
|
30 """Update the pagelet data.""" |
|
31 |
|
32 def render(self): |
|
33 """Render the pagelet content w/o o-wrap.""" |
|
34 |
|
35 |
|
36 class IPageletRenderer(IContentProvider): |
|
37 """Render a pagelet by calling it's 'render' method""" |
|
38 |
|
39 |
|
40 class IPageletCreatedEvent(IObjectEvent): |
|
41 """Pagelet created event interface""" |
|
42 |
|
43 request = Attribute('The request object') |
|
44 |
|
45 |
|
46 @implementer(IPageletCreatedEvent) |
|
47 class PageletCreatedEvent(ObjectEvent): |
|
48 """Pagelet created event""" |
|
49 |
|
50 def __init__(self, object): # pylint: disable=redefined-builtin |
|
51 super(PageletCreatedEvent, self).__init__(object) |
|
52 self.request = object.request |