示例#1
0
 def _add_attrs(self, elem, attrs):
     if not attrs:
         return elem
     attrs = attrs.items()
     attrs.sort()
     attrs = [ '%s="%s"' % (name, html_attr_escape(value))
               for name, value in attrs ]
     return '%s %s' % (elem, ' '.join(attrs))
示例#2
0
 def _add_attrs(self, elem, attrs):
     if not attrs:
         return elem
     attrs = attrs.items()
     attrs.sort()
     attrs = [
         '%s="%s"' % (name, html_attr_escape(value))
         for name, value in attrs
     ]
     return '%s %s' % (elem, ' '.join(attrs))
 def _get_attrs(self, attrs):
     if not attrs:
         return ''
     return ' ' + ' '.join('%s="%s"' % (name, html_attr_escape(attrs[name]))
                           for name in sorted(attrs))