# HG changeset patch # User catherine@dellzilla # Date 1237382901 14400 # Node ID 7aa24643e3581537510e4aa21d56d819cae7f5be # Parent 95195ec92c6c0a9cb56d6923b683fbd0175d9822 json almost working diff -r 95195ec92c6c -r 7aa24643e358 sqlpython/output_templates.py --- a/sqlpython/output_templates.py Tue Mar 17 17:23:18 2009 -0400 +++ b/sqlpython/output_templates.py Wed Mar 18 09:28:21 2009 -0400 @@ -14,14 +14,22 @@ """), + '\\j': genshi.template.NewTextTemplate(""" -{"${tblname}_resultset": [{% for row in rows %} - {${','.join('"%s": "%s"\\n ' % (colname, itm) for (colname, itm) in zip(colnames, row))} - } - {% end %}\ +{"${tblname}_resultset": [ + ${',\\n '.join('{%s}' % ( + ','.join('"%s": "%s"\\n ' % ((colname, itm) for (colname, itm) in zip(colnames, row))) + for row in rows))} ] }"""), +'\\j': genshi.template.NewTextTemplate(""" +{"${tblname}_resultset": [ +${',\\n'.join(' {%s}' % ', '.join('"%s": %s' % (colname,'"%s"' % itm) for (colname, itm) in zip(colnames, row)) for row in rows)} + ] +}"""), + + '\\h': genshi.template.MarkupTemplate("""