Package configuration¶
The zope.publisher
package provides a ZCML file that configures some
adapters and security:
>>> from zope.configuration.xmlconfig import XMLConfig
>>> import zope.publisher
>>> XMLConfig('configure.zcml', zope.publisher)()
>>> len(list(zope.component.getGlobalSiteManager().registeredUtilities()))
22
>>> len(list(zope.component.getGlobalSiteManager().registeredAdapters()))
11
ZCML Directives¶
This package also defines some ZCML directives for defining the
default skin (browser:defaultSkin
) and default view
(browser:defaultView
).
Default view and default skin ZCML configuration feature.
-
interface
zope.publisher.zcml.
IDefaultSkinDirective
[source]¶ Sets the default browser skin
-
name
¶ Default skin name
Default skin name
-
-
interface
zope.publisher.zcml.
IDefaultViewDirective
[source]¶ The name of the view that should be the default.
This name refers to view that should be the view used by default (if no view name is supplied explicitly).
-
name
¶ The name of the view that should be the default.
This name refers to view that should be the view used by default (if no view name is supplied explicitly).
-
for_
¶ The interface this view is the default for.
Specifies the interface for which the view is registered.
All objects implementing this interface can make use of this view. If this attribute is not specified, the view is available for all objects.
-
layer
¶ The layer the default view is declared for
The default layer for which the default view is applicable. By default it is applied to all layers.
-
-
zope.publisher.zcml.
setDefaultSkin
(name, info='')[source]¶ Set the default skin.
>>> from zope.interface import directlyProvides >>> from zope.app.testing import ztapi
>>> class Skin1: pass >>> directlyProvides(Skin1, IBrowserSkinType)
>>> ztapi.provideUtility(IBrowserSkinType, Skin1, 'Skin1') >>> setDefaultSkin('Skin1') >>> adapters = component.getSiteManager().adapters
Lookup the default skin for a request that has the>>> adapters.lookup((IBrowserRequest,), IDefaultSkin, '') is Skin1 True