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 CreateDetail(self, data): #------------------------------------------------------- return self.Create('detail.tpl', data)