5.2.4.2 valueexpr="..." attribute

Use the valueexpr attribute to specify an expression to be evaluated to derive the value to be compared with the comparison value of the enclosing <al-select> (5.2.3) tag.

If the valueexpr attribute evaluates to a 2-tuple, the first item becomes the value and the second becomes the label.

>>> import albatross
>>> ctx = albatross.SimpleContext('.')
>>> ctx.locals.spam = 'manufactured meat'
>>> ctx.locals.potato = ('mash', 'Mashed Potato')
>>> ctx.locals.sel = ['manufactured meat', 'eggs']
>>> albatross.Template(ctx, '<magic>', '''
... <al-select name="sel" multiple>
...  <al-option valueexpr="spam" />
...  <al-option valueexpr="potato" />
...  <al-option>eggs</al-option>
...  <al-option>bacon</al-option>
... </al-select whitespace>
... ''').to_html(ctx)
>>> ctx.flush_content()
<select multiple name="sel"><option selected>manufactured meat</option><option value="mash">Mashed Potato</option><option selected>eggs</option><option>bacon</option></select>