Plone 如何在集合模板中引用自定义字段

Plone 如何在集合模板中引用自定义字段,plone,dexterity,Plone,Dexterity,我正在尝试创建一个自定义集合模板,其中包括一些自定义字段 这就是我目前的情况: 但错误是:NameError:name“资源类型”未定义 我知道我需要定义这个变量,但我找不到正确的位置来定义它。 我试过了 根据Mathias的建议,我将定义移到了 然后得到了错误 Expression: <PathExpr standard:u'context/resource_type'> Names: {'container': <PloneSite at /hccrems>, '

我正在尝试创建一个自定义集合模板,其中包括一些自定义字段

这就是我目前的情况:

但错误是:NameError:name“资源类型”未定义

我知道我需要定义这个变量,但我找不到正确的位置来定义它。 我试过了

根据Mathias的建议,我将定义移到了

然后得到了错误

Expression: <PathExpr standard:u'context/resource_type'>
Names:

{'container': <PloneSite at /hccrems>,
 'context': <Collection at /hccrems/our-products/our-products/hccrems-purchasable-products/products>,
 'default': <object object at 0xb72c66a8>,
 'here': <Collection at /hccrems/our-products/our-products/hccrems-purchasable-products/products>,
 'loop': {u'item': <Products.PageTemplates.Expressions.PathIterator object at 0xb3dacf6c>},
表达式:
姓名:
{'container':,
“上下文”:,
“默认值”:,
“这里”:,
'循环':{u'item':},
注意到“context”指的是集合,而item是一个对象,所以我将它改为
tal:define=“resource\u type item/resource\u type;


现在很好。

你的Paste不见了……你能引用一个新的吗?或者在github上做一个要点。你可以在
中定义它。