我目前正在使用金字塔web框架并使用Mako模板进行配置。我知道我可以在视图方法(Pyramid - Is it possible to render my mako template as a string within my view callable?)中将模板呈现为字符串,但是,我想知道是否可以从视图中获取实际的模板对象,而不仅仅是用于呈现模板的函数。从金字塔应用程序视图中获取Mako模板
翻阅金字塔源代码,在mako_templating.py我看到默认的TemplateLookup类被Pyramid的查找方法覆盖。无论如何访问这个查找对象主要是因为我可以使用get_template函数是它的一部分吗?
谢谢你在这个问题上的任何方向。
谢谢你的回答,Michael!最后,我决定使用项目配置设置来实现单独的Mako Templatelookup实例。 – 2013-03-22 19:26:52