Skip to main content

Overview

z3c.discriminator provides a formalism for marking adapter specifications as discriminators in the sense that they will be used only for adapter lookup, not instantiation.

Using z3c.discriminator

To mark one or more interfaces as discriminators in a provideAdapter call, simply wrap your interface with the discriminator method:

>>> from z3c.discriminator import discriminator
>>> provideAdapter(MyAdapter, (IFoo, discriminator(IBar)))

To do the same in a Zope configuration file, prefix your dotted path with a dash like so:

<adapter for=”IFoo -IBar” factory=”some.package.YourFactory” />

Note that any interface in the declaration can be made a discriminator; they need not come in any particular order.

In your factory definition, simply require only the arguments that correspond to non-discriminator specifications, e.g.

class GetsOnlyFoo(object):
def __init__(self, foo):

-or-

def gets_only_bar(bar):

Changelog

Version 0.2 - November 26, 2007

  • Discriminator machinery is now introduced globally by patching the global adapter registry and the GlobalObject configuration field.

    The discriminator method now returns an interface that is in all aspects equal to the discriminated interface except it’s marked as a discriminator.

    Test suite have been expanded by including the entire test suite from zope.component. [malthe]

Version 0.1 - November 23, 2007

  • First public release [malthe]

Release files for z3c.discriminator 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for z3c.discriminator 0.2
File Size Uploaded
z3c.discriminator-0.2.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for z3c.discriminator 0.2
File Interpreter ABI Platform
z3c.discriminator-0.2-py2.4.egg Legacy Egg format - - Details

Total release size: 13.4 kB

Release files / z3c.discriminator-0.2.tar.gz

Download URL z3c.discriminator-0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0fce6e7fa74c4dec4d14c5b604402cfe202566ae7c9d82eefa29796529d9fb72
BLAKE2b-256 checksum
How to use checksums
11488ea87bf525797c2919b58f146bee412c2e52481eac5a903d2b060d6fef37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / z3c.discriminator-0.2-py2.4.egg

Download URL z3c.discriminator-0.2-py2.4.egg
Size 9.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
f02ed21dd41b6de21b6b5c07f01c53a0c70d45c5818d7b3f1891e0b088e3093b
BLAKE2b-256 checksum
How to use checksums
24762701a11aab361e1f7f80c21004c19f7b01c5491cd4a3d870d27557bcddba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page