uilib.py
changeset 10703 3cb87b61b067
parent 10702 f94c812c3669
child 10784 21bb9a00adeb
--- a/uilib.py	Thu Sep 17 11:07:36 2015 +0200
+++ b/uilib.py	Thu Sep 17 12:02:40 2015 +0200
@@ -340,8 +340,7 @@
         if self.parent:
             return u'%s.%s' % (self.parent, self.id)
         return text_type(self.id)
-    def __str__(self):
-        return text_type(self).encode('utf8')
+    __str__ = __unicode__ if PY3 else lambda self: self.__unicode__().encode('utf-8')
     def __getattr__(self, attr):
         return _JSId(attr, self)
     def __call__(self, *args):
@@ -359,6 +358,7 @@
         if self.parent:
             return u'%s(%s)' % (self.parent, ','.join(args))
         return ','.join(args)
+    __str__ = __unicode__ if PY3 else lambda self: self.__unicode__().encode('utf-8')
 
 class _JS(object):
     def __getattr__(self, attr):