mirror of
https://github.com/ChronosX88/medved.git
synced 2024-11-22 22:52:19 +00:00
18 lines
488 B
Python
18 lines
488 B
Python
from lib.exec 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
|