New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Integer type with SelectWidget renders wrong selected values #81
Comments
From SelectWidget doctstring:
I guess it'd be helpful to add a type check in |
What would be the reason not to convert it to unicode if parameter is not instance of basestring? |
I wouldn't be against converting a subset of types to str automagically (int is the only one I can really think of right now), but I wouldn't want the thing to try to convert any-old-thing to str, because that logic gets really desperate after a while and would end up causing even more confusion. |
Added a test to deformdemo in Pylons/deformdemo@740ae1f |
You rock. |
Argh, silly. My fix will break when first value is non-ascii unicode. Will fix tomorrow. I will nevertheless accept the compliment. ;-) |
Note there was a similar problem with RadioChoiceWidget, that the above commit patches. |
This turned out to be a bad idea, because for template code like this:
the 'value' above will be a string after normalization while the item in cstruct might be an integer. This is kind of a clusterfuck at this point because it was done so long ago, but I may need to revert it, because I can't think of a sane way to leave it the way it is. |
Nope, it's even more clusterfucked than just reverting. I'll keep it as-is for now and cope. |
Test case: https://gist.github.com/2225789
You will see first schema does not have selected value in output html, while second example does.
The text was updated successfully, but these errors were encountered: