changeset 267:95195ec92c6c

comma separation in genshi is hard
author catherine@dellzilla
date Tue, 17 Mar 2009 17:23:18 -0400
parents 342e96de6de6
children 7aa24643e358
files sqlpython/output_templates.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/output_templates.py	Mon Mar 16 23:30:41 2009 -0400
+++ b/sqlpython/output_templates.py	Tue Mar 17 17:23:18 2009 -0400
@@ -15,12 +15,13 @@
 </xml>"""),
 
 '\\j': genshi.template.NewTextTemplate("""
-{"${tblname}_resultset: [{% for row in rows %}
-    "${tblname}": {{% for (colname, itm) in zip(colnames, row) %}
-        "${colname.lower()}": "${itm}",{% end %} },
-    {% end %}]
+{"${tblname}_resultset": [{% for row in rows %}
+    {${','.join('"%s": "%s"\\n    ' % (colname, itm) for (colname, itm) in zip(colnames, row))}
+    }
+    {% end %}\
+    ]
 }"""),  
-      
+
 '\\h': genshi.template.MarkupTemplate("""
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns:py="http://genshi.edgewall.org/" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">