Skip to main content

Extensions to zope.configuration

Project description

1.0

Initial release.

Detailed Documentation

Configuration Extensions for Filtering or Inhibiting Configuration

The zc.configuration package provides some configuration directives for inhibiting configuration. The first of these is the excluse directive. It is used to exclude processing of configuration files. It is usedful when including a configuration that includes some other configuration that you don’t want. It must be used before including the files to be excluded.

First, let’s look at an example. The zope.configuration.demo package has a ZCML configuration that includes some other configuration files.

We’ll set a log handler so we can see what’s going on:

>>> import logging, sys
>>> logger = logging.getLogger('config')
>>> oldlevel = logger.level
>>> logger.setLevel(logging.DEBUG)
>>> handler = logging.StreamHandler(sys.stdout)
>>> logger.addHandler(handler)

Now, we’ll include the zc.configuration.demo config:

>>> from zope.configuration import xmlconfig
>>> _ = xmlconfig.string('<include package="zc.configuration.demo" />')
include /zc.configuration/src/zc/configuration/demo/configure.zcml
include /zc.configuration/src/zc/configuration/demo/sub/configure.zcml
include /zc.configuration/src/zc/configuration/demo/spam.zcml

Each run of the configuration machinery runs with fresh state, so rerunning gives the same thing:

>>> _ = xmlconfig.string('<include package="zc.configuration.demo" />')
include /zc.configuration/src/zc/configuration/demo/configure.zcml
include /zc.configuration/src/zc/configuration/demo/sub/configure.zcml
include /zc.configuration/src/zc/configuration/demo/spam.zcml

Now, we’ll load the zc.configuration meta.zcml and use the exclude directive to include the two files included by the configuration file in zc.configuration.demo:

>>> _ = xmlconfig.string(
... '''
... <configure  xmlns="http://namespaces.zope.org/zope">
...   <include package="zc.configuration" file="meta.zcml" />
...   <exclude package="zc.configuration.demo.sub" />
...   <exclude package="zc.configuration.demo" file="spam.zcml" />
...   <include package="zc.configuration.demo" />
... </configure>
... ''')
include /zc.configuration/src/zc/configuration/meta.zcml
include /zc.configuration/src/zc/configuration/demo/configure.zcml

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zc.configuration-1.0.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file zc.configuration-1.0.tar.gz.

File metadata

File hashes

Hashes for zc.configuration-1.0.tar.gz
Algorithm Hash digest
SHA256 3ebdd81c0f0d05fc09c80ce84d5621247815539e65e466221052147e983c17a2
MD5 37fd36bc3c2069091b67011977d7d09b
BLAKE2b-256 36f6dc4ef9b6cb82e93d4fc6bccad59e04ea903b3af6c19c76be33bd6e7ee93b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page