对不起,如果这个问题听起来很幼稚。我有一个猎豹模板,例如:
#filter None
<html>
<body>
$none should be ''
$number should be '1'
</body>
</html>
#end filter
namespace = {'none': None, 'number': 1}
所以基本上我想将所有 None 和非字符串值分别转换为 '' 和字符串。根据猎豹的文档: http: //www.cheetahtemplate.org/docs/users_guide_html_multipage/output.filter.html,我想要的是默认过滤器。这不就是我#filter None
在开始时所做的吗?怎么行不通?
请帮我解决这个问题。谢谢
编辑:
为了更清楚,基本上我希望它通过这个简单的if
测试:
#filter None
<html>
<body>
#if $none == '' and $number == '1':
<b>yay</b>
#end if
</body>
</html>
#end filter
所以如果一切顺利,我应该看到的是耶