vendor/Five/1.2b-r20590

view fivedirectives.py @ 0:3673ed425f80

Vendor import of Five 1.2b+ (r20590)
author fguillaume
date Fri, 02 Dec 2005 20:25:42 +0000
parents
children
line source
1 ##############################################################################
2 #
3 # Copyright (c) 2004, 2005 Zope Corporation and Contributors.
4 # All Rights Reserved.
5 #
6 # This software is subject to the provisions of the Zope Public License,
7 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11 # FOR A PARTICULAR PURPOSE.
12 #
13 ##############################################################################
14 """Five ZCML directive schemas
16 $Id: fivedirectives.py 19221 2005-10-31 01:44:26Z efge $
17 """
18 from zope.interface import Interface
19 from zope.app.publisher.browser.metadirectives import IBasicResourceInformation
20 from zope.app.security.fields import Permission
21 from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier
22 from zope.configuration.fields import Bool
23 from zope.schema import ASCII
24 from zope.schema import TextLine
26 class IImplementsDirective(Interface):
27 """State that a class implements something.
28 """
29 class_ = GlobalObject(
30 title=u"Class",
31 required=True
32 )
34 interface = Tokens(
35 title=u"One or more interfaces",
36 required=True,
37 value_type=GlobalObject()
38 )
40 class ITraversableDirective(Interface):
41 """Make instances of class traversable publically.
43 This can be used to browse to pages, resources, etc.
45 Traversal can be controlled by registering an ITraverser adapter.
46 """
47 class_ = GlobalObject(
48 title=u"Class",
49 required=True
50 )
52 class IDefaultViewableDirective(Interface):
53 """Make instances of class viewable publically.
55 The default view is looked up using a IBrowserDefault adapter.
56 """
57 class_ = GlobalObject(
58 title=u"Class",
59 required=True
60 )
62 class ISizableDirective(Interface):
63 """Make instances of class send events.
64 """
66 class_ = GlobalObject(
67 title=u"Class",
68 required=True
69 )
71 class IContainerEventsDirective(Interface):
72 """Global switch to enable container events
73 """
75 class IDeprecatedManageAddDeleteDirective(Interface):
76 """Call manage_afterAdd & co for these contained content classes.
77 """
78 class_ = GlobalObject(
79 title=u"Class",
80 required=True,
81 )
84 class IBridgeDirective(Interface):
85 """Bridge from a Zope 2 interface to an equivalent Zope3 interface.
86 """
87 zope2 = GlobalObject(
88 title=u"Zope2",
89 required=True
90 )
92 package = GlobalObject(
93 title=u"Target package",
94 required=True
95 )
97 name = PythonIdentifier(
98 title=u"Zope3 Interface name",
99 description=u"If not supplied, the new interface will have the same "
100 u"name as the source interface.",
101 required=False
102 )
104 class IPagesFromDirectoryDirective(IBasicResourceInformation):
105 """Register each file in a skin directory as a page resource
106 """
108 for_ = GlobalObject(
109 title=u"The interface this view is for.",
110 required=False
111 )
113 module = GlobalObject(
114 title=u"Module",
115 required=True
116 )
118 directory = TextLine(
119 title=u"Directory",
120 description=u"The directory containing the resource data.",
121 required=True
122 )
124 class IRegisterClassDirective(Interface):
126 """registerClass directive schema.
128 Register Five content with Zope 2.
129 """
131 class_ = GlobalObject(
132 title=u'Instance Class',
133 description=u'Dotted name of the class that is registered.',
134 required=True
135 )
137 meta_type = ASCII(
138 title=u'Meta Type',
139 description=u'A human readable unique identifier for the class.',
140 required=True
141 )
143 permission = Permission(
144 title=u'Add Permission',
145 description=u'The permission for adding objects of this class.',
146 required=True
147 )
149 addview = ASCII(
150 title=u'Add View ID',
151 description=u'The ID of the add view used in the ZMI. Consider this '
152 u'required unless you know exactly what you do.',
153 default=None,
154 required=False
155 )
157 icon = ASCII(
158 title=u'Icon ID',
159 description=u'The ID of the icon used in the ZMI.',
160 default=None,
161 required=False
162 )
164 global_ = Bool(
165 title=u'Global scope?',
166 description=u'If "global" is False the class is only available in '
167 u'containers that explicitly allow one of its interfaces.',
168 default=True,
169 required=False
170 )