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 resolveConflicts(_context.actions[nactions:]): action['includepath'] = includepath newactions.append(action) _context.actions[nactions:] = newactions
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
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. Conflicting actions added by the named *file* or *files* are resolved before this directive completes. .. caution:: If you do not specify a *file*, then the default file of ``configure.zcml`` will be used. A common use is to set *file* to ``overrides.zcml``. """ # 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 resolveConflicts(_context.actions[nactions:]): action['includepath'] = includepath newactions.append(action) _context.actions[nactions:] = newactions
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