Unicode bug when building error string in ForEach validator

Alberto Valverde <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
When using localized error messages, a UnicodeEncodeError is raised  
at formencode.foreach:90. The following patch fixes it:

Index: formencode/foreach.py
===================================================================
--- formencode/foreach.py       (revision 2406)
+++ formencode/foreach.py       (working copy)
@@ -88,7 +88,7 @@
                  return new_list
              else:
                  raise Invalid(
-                    'Errors:\n%s' % '\n'.join([str(e) for e in  
errors if e]),
+                    'Errors:\n%s' % '\n'.join([unicode(e) for e in  
errors if e]),
                      value,
                      state,
                      error_list=errors)

Alberto

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.