web/component.py
changeset 10713 ec0f96cd7a18
parent 10702 f94c812c3669
child 10903 da30851f9706
equal deleted inserted replaced
10712:f7227cbf1d18 10713:ec0f96cd7a18
    22 __docformat__ = "restructuredtext en"
    22 __docformat__ = "restructuredtext en"
    23 from cubicweb import _
    23 from cubicweb import _
    24 
    24 
    25 from warnings import warn
    25 from warnings import warn
    26 
    26 
    27 from six import add_metaclass
    27 from six import PY3, add_metaclass, text_type
    28 
    28 
    29 from logilab.common.deprecation import class_deprecated, class_renamed, deprecated
    29 from logilab.common.deprecation import class_deprecated, class_renamed, deprecated
    30 from logilab.mtconverter import xml_escape
    30 from logilab.mtconverter import xml_escape
    31 
    31 
    32 from cubicweb import Unauthorized, role, target, tags
    32 from cubicweb import Unauthorized, role, target, tags
   214         self.label = label
   214         self.label = label
   215         self.attrs = attrs
   215         self.attrs = attrs
   216 
   216 
   217     def __unicode__(self):
   217     def __unicode__(self):
   218         return tags.a(self.label, href=self.href, **self.attrs)
   218         return tags.a(self.label, href=self.href, **self.attrs)
       
   219 
       
   220     if PY3:
       
   221         __str__ = __unicode__
   219 
   222 
   220     def render(self, w):
   223     def render(self, w):
   221         w(tags.a(self.label, href=self.href, **self.attrs))
   224         w(tags.a(self.label, href=self.href, **self.attrs))
   222 
   225 
   223     def __repr__(self):
   226     def __repr__(self):