Exemplo n.º 1
0
def includeOverrides(_context, file=None, package=None, files=None):
    """Include zcml file containing overrides

    The actions in the included file are added to the context as if they
    were in the including file directly.

    See the detailed example in test_includeOverrides in
    tests/text_xmlconfig.py
    """

    # We need to remember how many actions we had before
    nactions = len(_context.actions)

    # We'll give the new actions this include path
    includepath = _context.includepath

    # Now we'll include the file. We'll munge the actions after
    include(_context, file, package, files)

    # Now we'll grab the new actions, resolve conflicts,
    # and munge the includepath:
    newactions = []
    for action in config.resolveConflicts(_context.actions[nactions:]):
        (discriminator, callable, args, kw, oldincludepath, info, order
         ) = config.expand_action(*action)
        newactions.append(
            (discriminator, callable, args, kw, includepath, info, order)
            )

    # and replace the new actions with the munched new actions:
    _context.actions[nactions:] = newactions
Exemplo n.º 2
0
def includeOverrides(_context, file=None, package=None, files=None):
    """Include zcml file containing overrides

    The actions in the included file are added to the context as if they
    were in the including file directly.

    See the detailed example in test_includeOverrides in
    tests/text_xmlconfig.py
    """

    # We need to remember how many actions we had before
    nactions = len(_context.actions)

    # We'll give the new actions this include path
    includepath = _context.includepath

    # Now we'll include the file. We'll munge the actions after
    include(_context, file, package, files)

    # Now we'll grab the new actions, resolve conflicts,
    # and munge the includepath:
    newactions = []
    for action in config.resolveConflicts(_context.actions[nactions:]):
        (discriminator, callable, args, kw, oldincludepath, info,
         order) = config.expand_action(*action)
        newactions.append(
            (discriminator, callable, args, kw, includepath, info, order))

    # and replace the new actions with the munched new actions:
    _context.actions[nactions:] = newactions
Exemplo n.º 3
0
def clean_actions(actions):
    return [{
        'discriminator': discriminator,
        'info': clean_info_path( ` info `),
        'includepath': [clean_path(p) for p in includepath],
    } for (discriminator, callable, args, kw, includepath, info,
           order) in [config.expand_action(*action) for action in actions]]
Exemplo n.º 4
0
def clean_actions(actions):
    return [
      {'discriminator': discriminator,
       'info': clean_info_path(`info`),
       'includepath': [clean_path(p) for p in includepath],
       }
      for (discriminator, callable, args, kw, includepath, info, order)
      in [config.expand_action(*action) for action in actions]
      ]
Exemplo n.º 5
0
def extract_actions(native):
    from zope.configuration.config import expand_action

    L = []
    for action in native:
        (discriminator, callable, args, kw, includepath, info, order) = expand_action(*action)
        d = {}
        d["discriminator"] = discriminator
        d["callable"] = callable
        d["args"] = args
        d["kw"] = kw
        d["order"] = order
        L.append(d)
    return L
Exemplo n.º 6
0
def extract_actions(native):
    from zope.configuration.config import expand_action
    L = []
    for action in native:
        (discriminator, callable, args, kw, includepath, info, order
         ) = expand_action(*action)
        d = {}
        d['discriminator'] = discriminator
        d['callable'] = callable
        d['args'] = args
        d['kw'] = kw
        d['order'] = order
        L.append(d)
    return L