Function
zope.configuration.config.resolveConflicts

Signature

resolveConflicts(actions)

Documentation String

Resolve conflicting actions

Given an actions list, identify and try to resolve conflicting actions. Actions conflict if they have the same non-null discriminator. Conflicting actions can be resolved if the include path of one of the actions is a prefix of the includepaths of the other conflicting actions and is unequal to the include paths in the other conflicting actions.

Here are some examples to illustrate how this works:

>>> from zope.configuration.tests.directives import f
>>> from pprint import PrettyPrinter
>>> pprint=PrettyPrinter(width=60).pprint
>>> pprint(resolveConflicts([
...    (None, f),
...    (1, f, (1,), {}, (), 'first'),
...    (1, f, (2,), {}, ('x',), 'second'),
...    (1, f, (3,), {}, ('y',), 'third'),
...    (4, f, (4,), {}, ('y',), 'should be last', 99999),
...    (3, f, (3,), {}, ('y',)),
...    (None, f, (5,), {}, ('y',)),
... ]))
[(None, f),
 (1, f, (1,), {}, (), 'first'),
 (3, f, (3,), {}, ('y',)),
 (None, f, (5,), {}, ('y',)),
 (4, f, (4,), {}, ('y',), 'should be last')]
>>> try:
...     v = resolveConflicts([
...        (None, f),
...        (1, f, (2,), {}, ('x',), 'eek'),
...        (1, f, (3,), {}, ('y',), 'ack'),
...        (4, f, (4,), {}, ('y',)),
...        (3, f, (3,), {}, ('y',)),
...        (None, f, (5,), {}, ('y',)),
...     ])
... except ConfigurationConflictError, v:
...    pass
>>> print v
Conflicting configuration actions
  For: 1
    eek
    ack