Revision: 2507
Author: janne.t.harkonen
Date: Tue Feb 23 01:15:56 2010
Log: cleanup
http://code.google.com/p/robotframework/source/detail?r=2507

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

=======================================
--- /trunk/src/robot/utils/unic.py      Mon Feb 22 05:29:43 2010
+++ /trunk/src/robot/utils/unic.py      Tue Feb 23 01:15:56 2010
@@ -15,10 +15,10 @@

 import os
 import sys
-import types


 if os.name == 'java':
+
     from java.lang import Object

     def unic(item):
@@ -28,12 +28,13 @@
         if sys.version_info[:2] > (2,2) and isinstance(item, Object):
             item = item.toString()
         return unicode(item)
+
 else:
+
     def unic(item):
         """Convert non-strings to unicode."""
-        typ = type(item)
-        if typ is types.UnicodeType:
+        if isinstance(item, unicode):
             return item
-        if typ is types.StringType:
-            return item.decode('UTF-8', 'ignore')
+        if isinstance(item, str):
+            return unicode(item, 'UTF-8', 'ignore')
         return unicode(item)

Reply via email to