[py3k] __unicode__ and __str__
authorRémi Cardona <remi.cardona@logilab.fr>
Fri, 18 Sep 2015 17:58:30 +0200
changeset 10713 ec0f96cd7a18
parent 10712 f7227cbf1d18
child 10714 8a2ec43fcf44
[py3k] __unicode__ and __str__
web/component.py
--- a/web/component.py	Mon Sep 21 19:00:26 2015 +0200
+++ b/web/component.py	Fri Sep 18 17:58:30 2015 +0200
@@ -24,7 +24,7 @@
 
 from warnings import warn
 
-from six import add_metaclass
+from six import PY3, add_metaclass, text_type
 
 from logilab.common.deprecation import class_deprecated, class_renamed, deprecated
 from logilab.mtconverter import xml_escape
@@ -217,6 +217,9 @@
     def __unicode__(self):
         return tags.a(self.label, href=self.href, **self.attrs)
 
+    if PY3:
+        __str__ = __unicode__
+
     def render(self, w):
         w(tags.a(self.label, href=self.href, **self.attrs))