common/uilib.py
branchtls-sprint
changeset 862 ee560986e211
parent 709 b21ee900c732
child 980 59552ba2015f
equal deleted inserted replaced
861:7985b5db2284 862:ee560986e211
   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         value += u' ' + u' '.join(u'%s="%s"' % (attr, html_escape(unicode(value)))
   212         value += u' ' + u' '.join(u'%s="%s"' % (attr, html_escape(unicode(value)))
   213                                   for attr, value in attrs.items())
   213                                   for attr, value in attrs.items()
       
   214                                   if value is not None)
   214     if content:
   215     if content:
   215         value += u'>%s</%s>' % (html_escape(unicode(content)), tag)
   216         value += u'>%s</%s>' % (html_escape(unicode(content)), tag)
   216     else:
   217     else:
   217         value += u'/>'
   218         value += u'/>'
   218     return value
   219     return value