52 lines
2.0 KiB
Python
Raw Normal View History

2016-11-03 20:35:10 +01:00
import os.path
from mako.template import Template
from mako.lookup import TemplateLookup
#----------------------------------------------------------
class View_cl(object):
#----------------------------------------------------------
#-------------------------------------------------------
2016-11-06 23:38:59 +01:00
def __init__(self):
2016-11-03 20:35:10 +01:00
#-------------------------------------------------------
2016-11-06 23:38:59 +01:00
self.path = 'templates'
self.lookup = TemplateLookup(directories=['/'])
2016-11-03 20:35:10 +01:00
#-------------------------------------------------------
2016-11-06 23:38:59 +01:00
def Create(self, template, data):
2016-11-03 20:35:10 +01:00
#-------------------------------------------------------
2016-11-06 23:38:59 +01:00
print("CreateView\n")
template = Template(filename=os.path.join(self.path, template), output_encoding='utf-8', lookup=self.lookup)
return template.render(data = data)
2016-11-03 20:35:10 +01:00
#-------------------------------------------------------
2016-11-06 23:38:59 +01:00
def CreateIndex(self):
2016-11-03 20:35:10 +01:00
#-------------------------------------------------------
2016-11-06 23:38:59 +01:00
print("CreateIndex\n")
data = None
return self.Create('index.tpl', data)
#-------------------------------------------------------
def CreateList(self, data):
#-------------------------------------------------------
return self.Create('list.tpl', data)
2016-11-17 00:28:30 +01:00
#-------------------------------------------------------
def CreateListChoice(self, data):
#-------------------------------------------------------
return self.Create('listChoice.tpl', data)
#-------------------------------------------------------
def CreateListEval(self, data):
#-------------------------------------------------------
return self.Create('listEval.tpl', data)
2016-11-06 23:38:59 +01:00
#-------------------------------------------------------
def CreateDetail(self, data):
#-------------------------------------------------------
2016-11-17 00:28:30 +01:00
return self.Create('detail.tpl', data)
#-------------------------------------------------------
def CreateDetailChoice(self, data):
#-------------------------------------------------------
return self.Create('detailChoice.tpl', data)