PPM2: select
This commit is contained in:
52
Praktikum2/ppm1/app/view.py
Normal file
52
Praktikum2/ppm1/app/view.py
Normal file
@@ -0,0 +1,52 @@
|
||||
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)
|
Reference in New Issue
Block a user