Introduction
This package provides means of hooking into the Zope (ZCML) configuration process.
Custom ZCML actions
It is sometimes useful to execute a function during the execution of configuration actions, for example to perform one-off configuration that does not warrant a new directive. The <zcml:customAction /> directive is provided for this purpose.
For example, you may want to call a function called my.package.finalConfiguration() “late” in the configuration action execution cycle. This can be achieved with the following ZCML statements:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="my.package">
<include package="z3c.zcmlhook" file="meta.zcml" />
<zcml:customAction
handler="my.package.finalConfiguration"
order="9999"
/>
</configure>
The handler attribute gives the name of a function to execute. The function should take no arguments. The order attribute is optional, and can be used to influence when in the configuration cycle the function is executed. The default value for this, as for most Zope configuration actions, is 0.
Overriding custom actions
If you want to override the invocation of a custom handler in an overrides.zcml, you need to tell zope.configuration which handler to override. You can do that by setting the discriminator explicitly. A discriminator is used to uniquely identify a configuration action. In the case of the <zcml:customAction /> directive, the discriminator is based on the full dotted name to the function by default. Thus, you could override the function call above like so:
<zcml:customAction
handler="my.otherpackage.overrideFinalConfiguration"
discriminator="my.package.finalConfiguration"
order="9999"
/>
Using a handler more than once
The discriminator attribute can also be used to explicitly allow using the same handler more than once. If you wanted to call my.package.finalConfiguration again, you would normally get a configuration conflict. However, with a (unique) custom discriminator, the second call is allowed:
<zcml:customAction
handler="my.package.finalConfiguration"
discriminator="my.package.finalConfiguration:early"
order="-9999"
/>
<zcml:customAction
handler="my.package.finalConfiguration"
discriminator="my.package.finalConfiguration:late"
order="9999"
/>
Here, we are attempting to call our configuration action “very early” as well as “very late” in the configuration process.
Changelog
3.1 (2026-09-25)
Move package metadata from setup.py to pyproject.toml.
Add support for Python 3.14.
Drop support for Python 3.9.
3.0 (2025-04-14)
Drop support for pkg_resources namespace and replace it with PEP 420 native namespace.
2.1 (2025-03-31)
Add support for Python 3.12, 3.13.
Drop support for Python 3.7, 3.8.
2.0 (2023-02-24)
Add support for Python 3.10, 3.11.
Drop support for Python 2.7, 3.5, 3.6.
1.1 (2021-02-15)
Add support for Python 3.5, 3.6, 3.7, 3.8 and 3.9.
Add test extra to declare test dependency on zope.component [test]. [icemac]
1.0b1 (2010-01-02)
Initial release [optilude]
Release files for z3c.zcmlhook 3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| z3c_zcmlhook-3.1.tar.gz | 9.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| z3c_zcmlhook-3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / z3c_zcmlhook-3.1.tar.gz
| Download URL | z3c_zcmlhook-3.1.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccd80fc31b157521a29a43427fe96734b10c03ab82c9cdf4b816d44e59ab6623
|
|
BLAKE2b-256 checksum How to use checksums |
9f6bff5411624055fc4842828a1dfeea8f992f5f21d65c293a99e9d56988bd98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / z3c_zcmlhook-3.1-py3-none-any.whl
| Download URL | z3c_zcmlhook-3.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3828a43628867f68312d5c4cdfee18d847adf5858a8193e5f29f1706b993a8f8
|
|
BLAKE2b-256 checksum How to use checksums |
1d40d29be575671cfe63a9d306785b728246a7cc172365b865754dfb58422910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log