8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
13 """PyAMS_template.metadirectives module |
|
14 |
|
15 This module provides ZCML directives interfaces |
|
16 """ |
|
17 |
|
18 from pyramid.interfaces import IRequest |
|
19 from zope.configuration.fields import GlobalInterface, GlobalObject, Path |
|
20 from zope.interface import Interface |
|
21 from zope.schema import ASCIILine, TextLine |
|
22 |
|
23 from pyams_template.interfaces import IContentTemplate, ILayoutTemplate |
14 |
24 |
15 |
25 |
16 # import standard library |
26 __docformat__ = 'restructuredtext' |
17 |
|
18 # import interfaces |
|
19 from pyramid.interfaces import IRequest |
|
20 |
|
21 # import packages |
|
22 from zope.configuration.fields import Path, GlobalObject, GlobalInterface |
|
23 from zope.interface import Interface |
|
24 from zope.schema import TextLine, ASCIILine |
|
25 from pyams_template.interfaces import IContentTemplate, ILayoutTemplate |
|
26 |
27 |
27 |
28 |
28 class ITemplateDirective(Interface): |
29 class ITemplateDirective(Interface): |
29 """Parameters for the template directive.""" |
30 """Parameters for the template directive.""" |
30 |
31 |
37 description="The name is used to look up the template.", |
38 description="The name is used to look up the template.", |
38 default='', |
39 default='', |
39 required=False) |
40 required=False) |
40 |
41 |
41 macro = TextLine(title='Macro', |
42 macro = TextLine(title='Macro', |
42 description=""" |
43 description="The macro to be used. This allows us to define different macros " |
43 The macro to be used. |
44 "in one template. The template designer can now create a whole " |
44 This allows us to define different macros in one template. |
45 "site, the ViewTemplate can then extract the macros for single " |
45 The template designer can now create a whole site, the |
46 "viewlets or views. If no macro is given the whole template is " |
46 ViewTemplate can then extract the macros for single viewlets |
47 "used for rendering.", |
47 or views. |
|
48 If no macro is given the whole template is used for rendering. |
|
49 """, |
|
50 default='', |
48 default='', |
51 required=False) |
49 required=False) |
52 |
50 |
53 for_ = GlobalObject(title='View', |
51 for_ = GlobalObject(title='View', |
54 description='The view for which the template should be available', |
52 description='The view for which the template should be available', |
68 description="This attribute specifies the interface the template " |
66 description="This attribute specifies the interface the template " |
69 "instance will provide.", |
67 "instance will provide.", |
70 default=IContentTemplate, |
68 default=IContentTemplate, |
71 required=False) |
69 required=False) |
72 |
70 |
73 contentType = ASCIILine(title='Content Type', |
71 content_type = ASCIILine(title='Content Type', |
74 description='The content type identifies the type of data.', |
72 description='The content type identifies the type of data.', |
75 default='text/html', |
73 default='text/html', |
76 required=False) |
74 required=False) |
77 |
75 |
78 |
76 |
79 class ILayoutTemplateDirective(ITemplateDirective): |
77 class ILayoutTemplateDirective(ITemplateDirective): |
80 """Parameters for the layout template directive.""" |
78 """Parameters for the layout template directive.""" |
81 |
79 |