Quite simply I'd like to print out all variables that are in scope in my genshi template, as a debugging and discovery measure. Is there a way to do it?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The standard Python function locals() (which returns a dict) works for me. I'm using Genshi 0.5.1, and as you'll see, everything seems to be in __data__
.
${repr(locals())}