27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
|
import os.path
|
||
|
from mako.template import Template
|
||
|
from mako.lookup import TemplateLookup
|
||
|
|
||
|
#----------------------------------------------------------
|
||
|
class View_cl(object):
|
||
|
#----------------------------------------------------------
|
||
|
|
||
|
#-------------------------------------------------------
|
||
|
def __init__(self, path_spl):
|
||
|
#-------------------------------------------------------
|
||
|
# Pfad hier zur Vereinfachung fest vorgeben
|
||
|
self.path_s = os.path.join(path_spl, "template")
|
||
|
self.lookup_o = TemplateLookup(directories=[self.path_s])
|
||
|
# ... weitere Methoden
|
||
|
|
||
|
#-------------------------------------------------------
|
||
|
def create_p(self, template_spl, data_opl):
|
||
|
#-------------------------------------------------------
|
||
|
# Auswertung mit templates
|
||
|
template_o = self.lookup_o.get_template(template_spl)
|
||
|
return template_o.render(data_o = data_opl) # hier wird da Template ausgeführt für die übergebenen Daten
|
||
|
|
||
|
#-------------------------------------------------------
|
||
|
def createList_px(self, data_opl):
|
||
|
#-------------------------------------------------------
|
||
|
return self.create_p('liste.tpl', data_opl)
|