Skip to content

Commit

Permalink
Jinja choice loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Snicker7 committed Sep 13, 2022
1 parent e0b6d7b commit ca7b25a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions CRISPRessoReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit ca7b25a

Please sign in to comment.