示例#1
0
文件: header.py 项目: nyren/occi-py
 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)
示例#2
0
文件: header.py 项目: nyren/occi-py
 def _to_string(self, header):
     item, attributes = header
     return '; '.join(
         ['%s' % item] +
         ['%s="%s"' % (name, escape_quotes(str(value))) for name, value in attributes])