Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install z3c.zcmlhook

How to install z3c.zcmlhook

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install z3c.zcmlhook
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0b1 Available View build log
Windows (64-bit)
1.0b1 Available View build log
Mac OS X (10.5+)
1.0b1 Available View build log
Linux (32-bit)
1.0b1 Available View build log
Linux (64-bit)
1.0b1 Available View build log
 
Author
License
ZPL
Lastest release
version 1.0b1 on Jan 5th, 2011

System Message: WARNING/2 (<string>, line 2)

Title underline too short.

ethodIntroduction
============

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

System Message: ERROR/3 (<string>, line 20)

Inconsistent literal block quoting.

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

System Message: ERROR/3 (<string>, line 51)

Inconsistent literal block quoting.

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

System Message: ERROR/3 (<string>, line 66)

Inconsistent literal block quoting.

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 =========

1.0b1 - January 2nd, 2010

  • Initial release

System Message: WARNING/2 (<string>, line 86)

Bullet list ends without a blank line; unexpected unindent.

[optilude]

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.