/usr/share/pyshared/zope/browserresource/metadirectives.py is in python-zope.browserresource 3.12.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | #############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# 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.
#
##############################################################################
"""ZCML directives for defining browser resources
"""
from zope.configuration.fields import GlobalObject, GlobalInterface
from zope.configuration.fields import Path, MessageID
from zope.interface import Interface
from zope.schema import TextLine, Int
from zope.security.zcml import Permission
class IBasicResourceInformation(Interface):
"""
This is the basic information for all browser resources.
"""
layer = GlobalInterface(
title=u"The layer the resource should be found in",
description=u"""
For information on layers, see the documentation for the skin
directive. Defaults to "default".""",
required=False
)
permission = Permission(
title=u"The permission needed to access the resource.",
description=u"""
If a permission isn't specified, the resource will always be
accessible.""",
required=False
)
class IResourceDirective(IBasicResourceInformation):
"""
Defines a browser resource
"""
name = TextLine(
title=u"The name of the resource",
description=u"""
This is the name used in resource urls. Resource urls are of
the form site/@@/resourcename, where site is the url of
"site", a folder with a site manager.
We make resource urls site-relative (as opposed to
content-relative) so as not to defeat caches.""",
required=True
)
factory = GlobalObject(
title=u"Resource Factory",
description=u"The factory used to create the resource. The factory "
u"should only expect to get the request passed when "
u"called.",
required=False
)
file = Path(
title=u"File",
description=u"The file containing the resource data. The resource "
u"type that will be created depends on file extension. "
u"The named IResourceFactoryFactory utilities are "
u"registered per extension. If no factory is registered "
u"for given file extension, the default FileResource "
u"factory will be used.",
required=False
)
image = Path(
title=u"Image",
description=u"""
If the image attribute is used, then an image resource, rather
than a file resource will be created.
This attribute is deprecated in favor of pluggable resource types,
registered per extension. Use the "file" attribute instead.
""",
required=False
)
template = Path(
title=u"Template",
description=u"""
If the template attribute is used, then a page template resource,
rather than a file resource will be created.
This attribute is deprecated in favor of pluggable resource types,
registered per extension. Use the "file" attribute instead. To
use page template resources, you need to instal zope.ptresource
package.
""",
required=False
)
class II18nResourceDirective(IBasicResourceInformation):
"""
Defines an i18n'd resource.
"""
name = TextLine(
title=u"The name of the resource",
description=u"""
This is the name used in resource urls. Resource urls are of
the form site/@@/resourcename, where site is the url of
"site", a folder with a site manager.
We make resource urls site-relative (as opposed to
content-relative) so as not to defeat caches.""",
required=True
)
defaultLanguage = TextLine(
title=u"Default language",
description=u"Defines the default language",
required=False
)
class II18nResourceTranslationSubdirective(IBasicResourceInformation):
"""
Subdirective to II18nResourceDirective.
"""
language = TextLine(
title=u"Language",
description=u"Language of this translation of the resource",
required=True
)
file = Path(
title=u"File",
description=u"The file containing the resource data.",
required=False
)
image = Path(
title=u"Image",
description=u"""
If the image attribute is used, then an image resource, rather
than a file resource will be created.
This attribute is deprecated, as images are now simply files.
Use the "file" attribute instead.
""",
required=False
)
class IResourceDirectoryDirective(IBasicResourceInformation):
"""
Defines a directory containing browser resource
"""
name = TextLine(
title=u"The name of the resource",
description=u"""
This is the name used in resource urls. Resource urls are of
the form site/@@/resourcename, where site is the url of
"site", a folder with a site manager.
We make resource urls site-relative (as opposed to
content-relative) so as not to defeat caches.""",
required=True
)
directory = Path(
title=u"Directory",
description=u"The directory containing the resource data.",
required=True
)
class IIconDirective(Interface):
"""
Define an icon for an interface
"""
name = TextLine(
title=u"The name of the icon.",
description=u"The name shows up in URLs/paths. For example 'foo'.",
required=True
)
for_ = GlobalInterface(
title=u"The interface this icon is for.",
description=u"""
The icon will be for all objects that implement this
interface.""",
required=True
)
file = Path(
title=u"File",
description=u"The file containing the icon.",
required=False
)
resource = TextLine(
title=u"Resource",
description=u"A resource containing the icon.",
required=False
)
title = MessageID(
title=u"Title",
description=u"Descriptive title",
required=False
)
layer = GlobalInterface(
title=u"The layer the icon should be found in",
description=u"""
For information on layers, see the documentation for the skin
directive. Defaults to "default".""",
required=False
)
width = Int(
title=u"The width of the icon.",
description=u"""
The width will be used for the <img width="..." />
attribute. Defaults to 16.""",
required=False,
default=16
)
height = Int(
title=u"The height of the icon.",
description=u"""
The height will be used for the <img height="..." />
attribute. Defaults to 16.""",
required=False,
default=16
)
|