<tal:block tal:repeat="image project/images">
<div
tal:define="onlyone python:if repeat.image.length==1: return 'onlyone'"
tal:attributes="class python:'image-{}'.format(repeat.image.number)">
<img
tal:define="img image/getObject"
tal:replace="structure img/@@images/image/custom_1280"
/>
</div>
</tal:block>
I already have a class the prints "image-N" based on the loop index, but how do I add another class if the length is "1"? The documentation is NOT clear https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#tales-python-expressions, it says any valid python expression can be used but the syntax is always wrong for me.
Fixed it myself.