[patch] accented characters in MultiListFields
Clemens Robbenhaar <robbenhaar-WaVJUzJ3u31Wk0Htik3J/[email protected]> Tue, 16 Nov 2004 10:28:13 +0100
| Newsgroups | gmane.comp.web.zope.formulator.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi David,
just a short reply:
>
> > I've created a form with both ListFields and MultiListFields
>
> > All fields have the validator/unicode checkbox checked
>
> > In ListFields, if I select an entry which contains accented
> > characters (stored as UTF-8 in the field definition), then
> > it works like a charm
>
> > In MultiListFields, if I do the same, the entry is rejected
> > with message "You selected an item that was not in the list."
Thanks for the bug report. I can easily reproduce the issue.
>
> > Solution, which seems to work : [...]
>
> --- zope-formulator-1.7.0.orig/Validator.py
> +++ zope-formulator-1.7.0/Validator.py
> @@ -485,7 +485,7 @@
> if int_value is not None and value_dict.has_key(int_value):
> result.append(int_value)
> continue
> - if value_dict.has_key(value):
> + if value_dict.has_key(str(value)):
> result.append(value)
> continue
> self.raise_error('unknown_selection', field)
>
I am not sure if applying a plain "str" conversion does not cause
some other harm ... I guess there should be a better way.
More this evening (european time).
Cheers,
Clemens