diff --git a/CRISPRessoReport.py b/CRISPRessoReport.py index 305e0fe6..79a4cd1e 100644 --- a/CRISPRessoReport.py +++ b/CRISPRessoReport.py @@ -5,7 +5,7 @@ ''' import os -from jinja2 import Environment, FileSystemLoader +from jinja2 import Environment, FileSystemLoader, ChoiceLoader from jinja_partials import generate_render_partial, render_partial from CRISPResso2 import CRISPRessoShared @@ -163,7 +163,11 @@ def make_report(run_data, crispresso_report_file, crispresso_folder, _ROOT, web_ 'crispresso_data_path': crispresso_data_path, } - j2_env = Environment(loader=FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates'))) + loader1 = FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates')) + loader2 = FileSystemLoader(os.path.join(_ROOT, 'templates')) + loader = ChoiceLoader([loader1, loader2]) + + j2_env = Environment(loader=loader) # dest_dir = os.path.dirname(crispresso_report_file) # shutil.copy2(os.path.join(_ROOT,'templates','CRISPResso_justcup.png'),dest_dir) @@ -473,9 +477,12 @@ def fill_default(dictionary, key, default_type=list): if key not in dictionary: dictionary[key] = default_type() - j2_env = Environment( - loader=FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates')), - ) + loader1 = FileSystemLoader(os.path.join(_ROOT, 'CRISPRessoReports', 'templates')) + loader2 = FileSystemLoader(os.path.join(_ROOT, 'templates')) + loader = ChoiceLoader([loader1, loader2]) + + j2_env = Environment(loader=loader) + j2_env.filters['dirname'] = dirname if crispresso_tool == 'batch': template = 'batchReport.html'