如何将文件系统Python文件中的值列表转换为TAL (由collective.portlet.tal提供)?
我的TAL代码如下所示:
<div tal:define="address_view context/@@address_view" >
<span tal:define="global li address_view/createPictMenu">
<span tal:re?lace="structure python:li[3]" />
</span>
</div>当我试图运行代码时,我得到了一个Invalid variable name li错误。正确的语法是什么?
发布于 2013-08-31 20:22:09
使用全局变量时,使用global作为前缀,否则TAL将找不到它:
<div tal:define="address_view context/@@address_view" >
<span tal:define="global li address_view/createPictMenu">
<span tal:re?lace="structure python: global li[3]" />
</span>
</div>或者,完全不要使用全局语言:
<div tal:define="address_view context/@@address_view" >
<span tal:define="li address_view/createPictMenu">
<span tal:re?lace="structure python:li[3]" />
</span>
</div>https://stackoverflow.com/questions/18547407
复制相似问题