Beispiel #1
0
 def _to_string(self, header):
     k, v = header
     if isinstance(v, int):
         value_str = str(v)
     elif isinstance(v, float):
         value_str = '%.2f' % v
     elif isinstance(v, bool):
         value_str = str(v).lower()
     else:
         value_str = '"%s"' % escape_quotes(str(v))
     return '%s=%s' % (k, value_str)
Beispiel #2
0
 def _to_string(self, header):
     item, attributes = header
     return '; '.join(
         ['%s' % item] +
         ['%s="%s"' % (name, escape_quotes(str(value))) for name, value in attributes])