common/uilib.py
branchtls-sprint
changeset 980 59552ba2015f
parent 862 ee560986e211
child 985 6a25c58a1c23
equal deleted inserted replaced
947:01f5001304b2 980:59552ba2015f
   207 
   207 
   208     content and attributes will be escaped
   208     content and attributes will be escaped
   209     """
   209     """
   210     value = u'<%s' % tag
   210     value = u'<%s' % tag
   211     if attrs:
   211     if attrs:
       
   212         try:
       
   213             attrs['class'] = attrs.pop('klass')
       
   214         except KeyError:
       
   215             pass
   212         value += u' ' + u' '.join(u'%s="%s"' % (attr, html_escape(unicode(value)))
   216         value += u' ' + u' '.join(u'%s="%s"' % (attr, html_escape(unicode(value)))
   213                                   for attr, value in attrs.items()
   217                                   for attr, value in attrs.items()
   214                                   if value is not None)
   218                                   if value is not None)
   215     if content:
   219     if content:
   216         value += u'>%s</%s>' % (html_escape(unicode(content)), tag)
   220         value += u'>%s</%s>' % (html_escape(unicode(content)), tag)