Fix wo_prompt

This commit is contained in:
VirtuBox
2019-08-16 23:46:44 +02:00
parent 5330a66621
commit e98ed1fe7a
3 changed files with 74 additions and 42 deletions

27
wo/core/template.py Normal file
View File

@@ -0,0 +1,27 @@
from wo.core.logging import Log
import os
"""
Render Templates
"""
class WOTemplate():
def tmpl_render(self, fileconf, template, data, overwrite=False):
if overwrite:
Log.debug(self, 'Writting the configuration to '
'file {0}'.format(fileconf))
wo_template = open('{0}'.format(fileconf),
encoding='utf-8', mode='w')
self.app.render((data), '{0}'.format(template),
out=wo_template)
wo_template.close()
else:
if not os.path.isfile('{0}'.format(fileconf)):
Log.debug(self, 'Writting the configuration to '
'file {0}'.format(fileconf))
wo_template = open('{0}'.format(fileconf),
encoding='utf-8', mode='w')
self.app.render((data), '{0}'.format(template),
out=wo_template)
wo_template.close()