Revision: 3024
Author: jprantan
Date: Fri Apr 16 04:53:28 2010
Log: Changed to fallback when cannot get any unicode repr for item.
http://code.google.com/p/robotframework/source/detail?r=3024

Modified:
 /trunk/src/robot/utils/unic.py

=======================================
--- /trunk/src/robot/utils/unic.py      Tue Mar 30 02:20:39 2010
+++ /trunk/src/robot/utils/unic.py      Fri Apr 16 04:53:28 2010
@@ -19,9 +19,13 @@
     # Based on a recipe from http://code.activestate.com/recipes/466341
     try:
         return unicode(item, *args)
-    except UnicodeDecodeError:
-        ascii_text = str(item).encode('string_escape')
-        return unicode(ascii_text)
+    except UnicodeError:
+        try:
+            ascii_text = str(item).encode('string_escape')
+        except UnicodeError:
+ return "<unrepresentable object '%s'>" % item.__class__.__name__
+        else:
+            return unicode(ascii_text)


 if sys.platform.startswith('java'):


--
Subscription settings: 
http://groups.google.com/group/robotframework-commit/subscribe?hl=en

Reply via email to