Max Ischenko wrote:
> > > In r1126 [1] I've removed the use of to_unicode from adjust_value, it
> > > should work all right since we are now using the CP decoding filter,
> > > anyway if you (for example Max and Jorge that I think need this
> > > feature) start experiencing problems we will just revert this change,
> > > it's just an attempt to reduce monkeypatching here and there. ;-)
> >
> > I appreciate the idea but not the results. ;-)
>
> The problem is that with the current setup there is no way it would work
> without to_unicode kludge.
>
> See, when I pass unicode string to field.display() it calls validator which
> turns it into utf-8 string which then fails when Kid interprets it as ascii
> string.
>
> May be we should fix the validator to do nothing in from_python but I'm far
> from sure. May be we should call adjust_value with convert=False whatever
> that means to skip validator. May be you'd better just put to_unicode back.
> ;-)
>
> One thing we should do for sure is to add a unit test which exercises
> unicode-related behaviour. I added primitive test_unicode_input() testcase to
> test_widgets.py. It passes with to_unicode() in-place and fails without.
>
> Please put to_unicode() back and then look for better solution. ;-)
>
> One pain with Kid is that once this encoded-string slips in and Kid fails it
> gives incomprehensible error message. May be we should try to detect such
> errors ourselves to at least fail in a meaningful way. I mean adding
> something like this to adjust_value():
>
> if isinstance(value, str):
> try:
> unicode(value)
> except UnicodeDecodeError:
> raise ValueError("Non-unicode string in %s: %r" % (self,
> value))
>
> Max.
Hi Max,
It's great to have you watching unicode related things as I'm not
experienced on this camp, thanks for the test, as I said there is not
problem, I'm going to put to_unicode back into the game! ;-)
Ciao
Michele
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---