Re: Unicode characters and htmlfill issue
Marius Gedminas <[email protected]> Sat, 28 Mar 2009 01:59:55 +0200
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
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-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFJzWh7kVdEXeem148RAosLAJ9kxd0Q6is6uHE6DbNp5pi8f86hlACdHL58 ptkusW1iALlHHyhOcDwg05Q= =qEFG -----END PGP SIGNATURE-----