def render(self):
# make local variables for the loop below (faster)
local_dict = self.key_dict
local_template = self.template
local_varlist = self.template.varlist
local_odel = self.odel
local_cdel = self.cdel
local_htmlent = self.html_entities
if local_htmlent:
from xml.sax.saxutils import escape #from Python std lib
for key in local_dict:
if key in local_varlist:
value = local_dict[key]
replace_string = local_odel + key + local_cdel
if local_htmlent:
value = escape(value) #xml.sax.saxutils function
local_template = local_template.replace(replace_string, value)
return local_template
##TODO : multiple file render method?
评论列表
文章目录