Gavin suggested that we need to handle yaml escaping properly in templates:
-----
We could/ought to add the following escape function to the templates:
from StringIO import StringIO import yaml
def quote_yaml(thing): buf = StringIO() dumper = yaml.SafeDumper(buf, encoding=None) try: dumper.open() if isinstance(thing, unicode): # Force double-quote style for unicode strings. dumper.write_double_quoted(string) else: dumper.represent(thing) dumper.close() finally: dumper.dispose() return buf.getvalue()
Gavin suggested that we need to handle yaml escaping properly in templates:
-----
We could/ought to add the following escape function to the templates:
from StringIO import StringIO
import yaml
def quote_yaml(thing): (buf, encoding=None)
dumper. open()
dumper. write_double_ quoted( string)
dumper. represent( thing)
dumper. close()
dumper. dispose( )
buf = StringIO()
dumper = yaml.SafeDumper
try:
if isinstance(thing, unicode):
# Force double-quote style for unicode strings.
else:
finally:
return buf.getvalue()