Mercurial > sqlpython
changeset 269:e4869b369e12
json now works with numbers, etc
author | catherine@dellzilla |
---|---|
date | Wed, 18 Mar 2009 09:44:25 -0400 |
parents | 7aa24643e358 |
children | dd80e46b5ca2 |
files | sqlpython/output_templates.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/sqlpython/output_templates.py Wed Mar 18 09:28:21 2009 -0400 +++ b/sqlpython/output_templates.py Wed Mar 18 09:44:25 2009 -0400 @@ -24,8 +24,10 @@ }"""), '\\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)} +{"${tblname}": [ +${',\\n'.join(' {%s}' % ', '.join('"%s": %s' % (colname, + ((isinstance(itm,int) or isinstance(itm,float)) and '%s' or '"%s"') % str(itm) + ) for (colname, itm) in zip(colnames, row)) for row in rows)} ] }"""),