52 lines
2.0 KiB
Python
52 lines
2.0 KiB
Python
import os.path
|
|
from mako.template import Template
|
|
from mako.lookup import TemplateLookup
|
|
|
|
#----------------------------------------------------------
|
|
class View_cl(object):
|
|
#----------------------------------------------------------
|
|
|
|
#-------------------------------------------------------
|
|
def __init__(self):
|
|
#-------------------------------------------------------
|
|
self.path = 'templates'
|
|
self.lookup = TemplateLookup(directories=['/'])
|
|
|
|
#-------------------------------------------------------
|
|
def Create(self, template, data):
|
|
#-------------------------------------------------------
|
|
print("CreateView\n")
|
|
template = Template(filename=os.path.join(self.path, template), output_encoding='utf-8', lookup=self.lookup)
|
|
return template.render(data = data)
|
|
|
|
#-------------------------------------------------------
|
|
def CreateIndex(self):
|
|
#-------------------------------------------------------
|
|
print("CreateIndex\n")
|
|
data = None
|
|
return self.Create('index.tpl', data)
|
|
|
|
#-------------------------------------------------------
|
|
def CreateList(self, data):
|
|
#-------------------------------------------------------
|
|
return self.Create('list.tpl', data)
|
|
|
|
#-------------------------------------------------------
|
|
def CreateListChoice(self, data):
|
|
#-------------------------------------------------------
|
|
return self.Create('listChoice.tpl', data)
|
|
|
|
#-------------------------------------------------------
|
|
def CreateListEval(self, data):
|
|
#-------------------------------------------------------
|
|
return self.Create('listEval.tpl', data)
|
|
|
|
#-------------------------------------------------------
|
|
def CreateDetail(self, data):
|
|
#-------------------------------------------------------
|
|
return self.Create('detail.tpl', data)
|
|
|
|
#-------------------------------------------------------
|
|
def CreateDetailChoice(self, data):
|
|
#-------------------------------------------------------
|
|
return self.Create('detailChoice.tpl', data) |