Mercurial > genshi > mirror
changeset 415:b9f9a22484f0 trunk
`HTMLFormFiller` now correctly deals with non-string values in the data dictionary for select/checkbox/radio controls.
author | cmlenz |
---|---|
date | Mon, 12 Mar 2007 12:29:17 +0000 |
parents | 5cd03affab4a |
children | afd4a51442fa |
files | genshi/filters.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/genshi/filters.py +++ b/genshi/filters.py @@ -93,12 +93,13 @@ checked = False if isinstance(value, (list, tuple)): if declval: - checked = declval in value + checked = declval in [str(v) for v + in value] else: checked = bool(filter(None, value)) else: if declval: - checked = declval == value + checked = declval == str(value) elif type == 'checkbox': checked = bool(value) if checked: @@ -150,9 +151,10 @@ select_value = None elif in_select and tagname == 'option': if isinstance(select_value, (tuple, list)): - selected = option_value in select_value + selected = option_value in [str(v) for v + in select_value] else: - selected = option_value == select_value + selected = option_value == str(select_value) okind, (tag, attrs), opos = option_start if selected: attrs |= [(QName('selected'), 'selected')]