On Fri, Mar 27, 2009 at 12:58:51PM +0100, Andrea Riciputi wrote:
> However, during these experiments, I've found a little glitch in the
> String() validator behaviour. As you pointed out String() leaves the
> strings untouched. In fact, this is not completely true. Just try:
>
> assert String().to_python(u'') is u''
> assert String().from_python(u'') is u''
>
> You get in both cases an assertion exception since, both calls to .to/
> from_python() returns '' (and not u'' as expected).
>
> I agree that returning an empty basestring instead of the empty unicode
> string is not a great problem. However, I still think it should be fixed
> anyway. Any comment?
I'll just note in passing that doing identity checks on strings (x is y)
is a bad idea.
Does the behaviour that you observed cause problems in practice?
Marius Gedminas
--
1 + 1 = 3
-- from a Microsoft advertisement
------------------------------------------------------------------------------
_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss