I have the following code in a Chameleon
template:
<span tal:repeat="menu view.site_menu">
<tal:block tal:condition="menu.current">
<span>${menu.title}</span>
</tal:block>
<tal:block tal:condition="not menu.current">
<span><a href="/${menu.href}">${menu.title}</a></span>
</tal:block>
<tal:block tal:condition="not repeat/menu/end">
<span> | </span>
</tal:block>
</span>
When I try to render this page I get the following error:
TypeError: unsupported operand type(s) for /: 'RepeatDict' and 'dict'
- Expression: "not repeat/menu/end"
...
Can anyone see what I am doing wrong here?
I was able by trial and error to find a solutions to my problem. Here is the working code:
<span tal:repeat="menu view.site_menu">
<tal:block tal:condition="menu.current">
<span>${menu.title}</span>
</tal:block>
<tal:block tal:condition="not menu.current">
<span><a href="/${menu.href}">${menu.title}</a></span>
</tal:block>
<tal:block tal:condition="not repeat.menu.end">
<span tal:omit-tag="">|</span>
</tal:block>
</span>
This works as expected and puts the separator in between each menu item and not at the end.
I was sure I had tried this before but it is working now.