[Formed-commits] r411 - trunk/formed/formed/plugins/export

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Oct 6 14:22:10 CEST 2010


Author: torsten
Date: 2010-10-06 14:22:10 +0200 (Wed, 06 Oct 2010)
New Revision: 411

Modified:
   trunk/formed/formed/plugins/export/rules_sh.py
Log:
* formed/formed/plugins/export/rules_sh.py (sql_date): Fixed sql_date
function.


Modified: trunk/formed/formed/plugins/export/rules_sh.py
===================================================================
--- trunk/formed/formed/plugins/export/rules_sh.py	2010-10-06 09:33:39 UTC (rev 410)
+++ trunk/formed/formed/plugins/export/rules_sh.py	2010-10-06 12:22:10 UTC (rev 411)
@@ -27,7 +27,7 @@
 
 def sql_date(node, document):
     out = []
-    out.append('%s::date' % node.eval())
+    out.append("'%s'::date" % node.eval(None))
     return " ".join(out)
 
 def sql_var(node, document): 
@@ -120,7 +120,7 @@
     elif isinstance(node, Today):
         out.append(sql_today(node, document))
     elif isinstance(node, DateNode):
-        out.append(sql_today(node, document))
+        out.append(sql_date(node, document))
     else:
         raise Exception('Can not parse %s' % node) 
     return " ".join(out)
@@ -199,7 +199,7 @@
     tag = "10"
     name = "Datumsangaben konsistent"
     desc = "Alle Datumsangaben in der Fallakte befinden sich in chronologisch korrekter Reihenfolge und liegen nicht in der Zukunft"
-    add_sql = "select id from master_tbl_view m where not ARRAY(SELECT tag_id FROM nm_tags_cases_view WHERE case_id = m.id)  && ARRAY[%s]" % ",".join([str(id) for id in date_rules])
+    add_sql = "select id from ( %%(table)s ) m where not ARRAY(SELECT tag_id FROM nm_tags_cases_view WHERE case_id = m.id)  && ARRAY[%s]" % ",".join([str(id) for id in date_rules])
     del_sql = base_sql % {'where': "TRUE"}
     out.append(generate_check(tag, name, desc, add_sql, del_sql))
     #inserts.append("""INSERT INTO tags (id, label, description) VALUES (%s, '%s','%s');""" % (tag, name.replace("'", '"'), desc.replace("'", '"')))



More information about the Formed-commits mailing list