mirror of
https://github.com/ChronosX88/medved.git
synced 2024-11-26 16:22:19 +00:00
18 lines
488 B
Python
18 lines
488 B
Python
|
from lib.exeq import Task
|
||
|
from jinja2 import Environment, FileSystemLoader
|
||
|
|
||
|
|
||
|
class Jinja2TemplateTask(Task):
|
||
|
def __init__(self, id, root):
|
||
|
super().__init__(id, root)
|
||
|
|
||
|
def _process(self, item):
|
||
|
template = Environment(loader=FileSystemLoader('.')).get_template(self.lcnf.get('path'))
|
||
|
item['data']['message'] = template.render(data = item['data'])
|
||
|
item['steps'][self._id] = True
|
||
|
|
||
|
def _run(self, items):
|
||
|
for item in items:
|
||
|
self._process(item)
|
||
|
return items
|