Small correction ... > <option tal:attributes="python: test(foo == bar, 'selected', None)" ... Should be: <option tal:attributes="selected python: test(foo == bar, 'selected', None)" ...