def add_backup_handlers(tree, ignore=None, dynamic=None, static=None): root = CfgSubtree(None, None) for paths, handler in ( (ignore, 'ignore'), (dynamic, 'dynamic'), (static, 'static') ): if paths is None: continue for path in paths: root._add_child_path('plain', path, handler=handler) tree.set_backup_handlers(root)
def make_cfgsubtree(spec): root = CfgSubtree(None, None) for item in spec: root._add_child_path(item[0], item[1], handler=item[2]) return root