def test_loader_default_nbconvert(): paths = collect_paths(['nbconvert'], 'default', root_dirs=ROOT_DIRS) loader = FileSystemLoader(paths) env = Environment(loader=loader) template = env.get_template('index.tpl') output = template.render() assert 'this is block base:nested in nbconvert/default/index.tpl' in output
def test_loader_bar_voila(): paths = collect_paths(['voila', 'nbconvert'], 'bar', root_dirs=ROOT_DIRS) loader = FileSystemLoader(paths) env = Environment(loader=loader) template = env.get_template('index.tpl') output = template.render() assert 'this is block base in nbconvert/bar/index.tpl' in output assert 'this is block base in nbconvert/default/index.tpl' in output assert 'this is block base:nested in voila/default/index.tpl' in output assert 'this is block base:nested2 in nbconvert/default/index.tpl' in output assert 'this is block common in nbconvert/bar/parent.tpl' in output
def monkey_collect_static_paths( app_names, template_name='default', prune=False, root_dirs=None ): original = voila_paths.collect_paths( app_names, template_name, include_root_paths=False, prune=prune, root_dirs=root_dirs, subdir='static', ) flex_static1 = os.path.join(settings.templates_dir, "nbconvert", "flex") flex_static2 = os.path.join( settings.templates_dir, "nbconvert", "flex", "static" ) flex_static_templates = [flex_static1, flex_static2] return flex_static_templates + original
def monkey_collect_template_paths( app_names, template_name='default', prune=False, root_dirs=None ): print("MONKEY TEMPLATES") original = voila_paths.collect_paths( app_names, template_name, include_root_paths=True, prune=prune, root_dirs=root_dirs, ) flex_base_templates = os.path.join(settings.templates_dir) flex_voila_templates = os.path.join( settings.templates_dir, "voila", "flex" ) flex_templates = [flex_base_templates, flex_voila_templates] return flex_templates + original