def call_contextual_template(template):
# this is the magic line
frame = inspect.currentframe().f_back
# again, we don't care about efficiency, it's not the point here
d = dict(frame.f_globals)
d.update(frame.f_locals)
return call_template(template,d)
评论列表
文章目录