Author: ianb
Date: 2006-05-12 14:10:59 -0600 (Fri, 12 May 2006)
New Revision: 1766
Modified:
FormEncode/trunk/formencode/schema.py
Log:
Fix for TG internationalization from Max Ischenko
Modified: FormEncode/trunk/formencode/schema.py
===================================================================
--- FormEncode/trunk/formencode/schema.py 2006-05-12 20:09:08 UTC (rev 1765)
+++ FormEncode/trunk/formencode/schema.py 2006-05-12 20:10:59 UTC (rev 1766)
@@ -289,7 +289,14 @@
def format_compound_error(v, indent=0):
if isinstance(v, Exception):
- return str(v)
+ try:
+ return str(v)
+ except UnicodeDecodeError:
+ # There doesn't seem to be a better way to get a str()
+ # version if possible, and unicode() if necessary, because
+ # testing for the presence of a __unicode__ method isn't
+ # enough
+ return unicode(v)
elif isinstance(v, dict):
l = v.items()
l.sort()
|