vendor/Five/1.2b-r20590

diff 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 diff
     1.1 new file mode 100644
     1.2 --- /dev/null
     1.3 +++ b/fivedirectives.py
     1.4 @@ -0,0 +1,170 @@
     1.5 +##############################################################################
     1.6 +#
     1.7 +# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
     1.8 +# All Rights Reserved.
     1.9 +#
    1.10 +# This software is subject to the provisions of the Zope Public License,
    1.11 +# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
    1.12 +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
    1.13 +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    1.14 +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
    1.15 +# FOR A PARTICULAR PURPOSE.
    1.16 +#
    1.17 +##############################################################################
    1.18 +"""Five ZCML directive schemas
    1.19 +
    1.20 +$Id: fivedirectives.py 19221 2005-10-31 01:44:26Z efge $
    1.21 +"""
    1.22 +from zope.interface import Interface
    1.23 +from zope.app.publisher.browser.metadirectives import IBasicResourceInformation
    1.24 +from zope.app.security.fields import Permission
    1.25 +from zope.configuration.fields import GlobalObject, Tokens, PythonIdentifier
    1.26 +from zope.configuration.fields import Bool
    1.27 +from zope.schema import ASCII
    1.28 +from zope.schema import TextLine
    1.29 +
    1.30 +class IImplementsDirective(Interface):
    1.31 +    """State that a class implements something.
    1.32 +    """
    1.33 +    class_ = GlobalObject(
    1.34 +        title=u"Class",
    1.35 +        required=True
    1.36 +        )
    1.37 +
    1.38 +    interface = Tokens(
    1.39 +        title=u"One or more interfaces",
    1.40 +        required=True,
    1.41 +        value_type=GlobalObject()
    1.42 +        )
    1.43 +
    1.44 +class ITraversableDirective(Interface):
    1.45 +    """Make instances of class traversable publically.
    1.46 +
    1.47 +    This can be used to browse to pages, resources, etc.
    1.48 +
    1.49 +    Traversal can be controlled by registering an ITraverser adapter.
    1.50 +    """
    1.51 +    class_ = GlobalObject(
    1.52 +        title=u"Class",
    1.53 +        required=True
    1.54 +        )
    1.55 +
    1.56 +class IDefaultViewableDirective(Interface):
    1.57 +    """Make instances of class viewable publically.
    1.58 +
    1.59 +    The default view is looked up using a IBrowserDefault adapter.
    1.60 +    """
    1.61 +    class_ = GlobalObject(
    1.62 +        title=u"Class",
    1.63 +        required=True
    1.64 +        )
    1.65 +
    1.66 +class ISizableDirective(Interface):
    1.67 +    """Make instances of class send events.
    1.68 +    """
    1.69 +
    1.70 +    class_ = GlobalObject(
    1.71 +        title=u"Class",
    1.72 +        required=True
    1.73 +        )
    1.74 +
    1.75 +class IContainerEventsDirective(Interface):
    1.76 +    """Global switch to enable container events
    1.77 +    """
    1.78 +
    1.79 +class IDeprecatedManageAddDeleteDirective(Interface):
    1.80 +    """Call manage_afterAdd & co for these contained content classes.
    1.81 +    """
    1.82 +    class_ = GlobalObject(
    1.83 +        title=u"Class",
    1.84 +        required=True,
    1.85 +        )
    1.86 +
    1.87 +
    1.88 +class IBridgeDirective(Interface):
    1.89 +    """Bridge from a Zope 2 interface to an equivalent Zope3 interface.
    1.90 +    """
    1.91 +    zope2 = GlobalObject(
    1.92 +        title=u"Zope2",
    1.93 +        required=True
    1.94 +        )
    1.95 +
    1.96 +    package = GlobalObject(
    1.97 +        title=u"Target package",
    1.98 +        required=True
    1.99 +        )
   1.100 +
   1.101 +    name = PythonIdentifier(
   1.102 +        title=u"Zope3 Interface name",
   1.103 +        description=u"If not supplied, the new interface will have the same "
   1.104 +                    u"name as the source interface.",
   1.105 +        required=False
   1.106 +        )
   1.107 +
   1.108 +class IPagesFromDirectoryDirective(IBasicResourceInformation):
   1.109 +    """Register each file in a skin directory as a page resource
   1.110 +    """
   1.111 +
   1.112 +    for_ = GlobalObject(
   1.113 +        title=u"The interface this view is for.",
   1.114 +        required=False
   1.115 +        )
   1.116 +
   1.117 +    module = GlobalObject(
   1.118 +        title=u"Module",
   1.119 +        required=True
   1.120 +        )
   1.121 +
   1.122 +    directory = TextLine(
   1.123 +        title=u"Directory",
   1.124 +        description=u"The directory containing the resource data.",
   1.125 +        required=True
   1.126 +        )
   1.127 +
   1.128 +class IRegisterClassDirective(Interface):
   1.129 +
   1.130 +    """registerClass directive schema.
   1.131 +
   1.132 +    Register Five content with Zope 2.
   1.133 +    """
   1.134 +
   1.135 +    class_ = GlobalObject(
   1.136 +        title=u'Instance Class',
   1.137 +        description=u'Dotted name of the class that is registered.',
   1.138 +        required=True
   1.139 +        )
   1.140 +
   1.141 +    meta_type = ASCII(
   1.142 +        title=u'Meta Type',
   1.143 +        description=u'A human readable unique identifier for the class.',
   1.144 +        required=True
   1.145 +        )
   1.146 +
   1.147 +    permission = Permission(
   1.148 +        title=u'Add Permission',
   1.149 +        description=u'The permission for adding objects of this class.',
   1.150 +        required=True
   1.151 +        )
   1.152 +
   1.153 +    addview = ASCII(
   1.154 +        title=u'Add View ID',
   1.155 +        description=u'The ID of the add view used in the ZMI. Consider this '
   1.156 +                    u'required unless you know exactly what you do.',
   1.157 +        default=None,
   1.158 +        required=False
   1.159 +        )
   1.160 +
   1.161 +    icon = ASCII(
   1.162 +        title=u'Icon ID',
   1.163 +        description=u'The ID of the icon used in the ZMI.',
   1.164 +        default=None,
   1.165 +        required=False
   1.166 +        )
   1.167 +
   1.168 +    global_ = Bool(
   1.169 +        title=u'Global scope?',
   1.170 +        description=u'If "global" is False the class is only available in '
   1.171 +                    u'containers that explicitly allow one of its interfaces.',
   1.172 +        default=True,
   1.173 +        required=False
   1.174 +        )