[Formed-commits] r307 - in trunk: . formed/formed/plugins/export
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Feb 6 18:24:27 CET 2009
Author: teichmann
Date: 2009-02-06 18:24:27 +0100 (Fri, 06 Feb 2009)
New Revision: 307
Modified:
trunk/ChangeLog
trunk/formed/formed/plugins/export/sql.py
Log:
Repair SQL schema creation for radio groups.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-02-06 13:39:56 UTC (rev 306)
+++ trunk/ChangeLog 2009-02-06 17:24:27 UTC (rev 307)
@@ -1,3 +1,31 @@
+2009-02-09 Sascha L. Teichmanne <teichmann at intevation.de>
+
+ Repair SQL schema creation for radio groups.
+
+ * formed/formed/plugins/export/sql.py: radio groups are handled
+ like choices now.
+
+2009-02-09 Sascha L. Teichmanne <teichmann at intevation.de>
+
+ Make it startable again.
+
+ * formed/formed/plugins/export/xls.py: Import pyExcelerator only
+ when plug-in is called.
+
+ * formed/formed/model/nodecomponents.py: Event routing was messed up.
+ Rewired root node with document.
+
+ * formed/formed/plugins/web/help.py: Removed old xml.ext import.
+ XXX: This breaks creating help by now!
+
+ * formed/formed/io/parser.py: Replace old deprecated base class
+ by new one.
+
+ * formed/formed/main.py: Do not crash if locale cannot be set.
+
+ * formed/formed/ui/controls.py: Use document.getCase() instead
+ of document.case to prevent uninitialized dereferences.
+
2009-01-22 Torsten Irländer <torsten.irlaender at intevation.de>
Implemented new XML-Format for formed xml files.
Modified: trunk/formed/formed/plugins/export/sql.py
===================================================================
--- trunk/formed/formed/plugins/export/sql.py 2009-02-06 13:39:56 UTC (rev 306)
+++ trunk/formed/formed/plugins/export/sql.py 2009-02-06 17:24:27 UTC (rev 307)
@@ -472,27 +472,45 @@
radioTable.appendColumn(Column('id', 'INTEGER PRIMARY KEY NOT NULL'))
radioTable.appendColumn(Column('value', 'VARCHAR(%d) NOT NULL' % max_length))
- idx = -1
+ default_idx = None
+
for i, child in enumerate(radio.children):
cname = child.getName()
- if idx == -1 and cname == selected:
- idx = i
+ try:
+ value = int(child.getValue())
+ except ValueError:
+ print >> sys, "WARNING: cannot convert radio '%s' value '%s' to integer" % (
+ cname, child.getValue())
+ continue
+
+ if default_idx is None and (child.getChecked() or cname == selected):
+ default_idx = value
+
radioTable.appendInsert("(id, value) VALUES (%d, '%s')" % (
- i, sqlQuote(cname)))
+ value, sqlQuote(child.getDescription())))
- self.tables.append(radioTable)
+ other = self.findSameContent(radioTable)
+ if other:
+ into = other.name
+ print >> sys.stderr, "Found radio '%s" % into
+ else:
+ into = name + "_tbl"
+ self.tables.append(radioTable)
+
table = self.tableStack[-1]
- if idx != -1:
- table.appendColumn(Column(name, 'INTEGER DEFAULT %d' % idx, func=radio.getFunction()))
- else:
- table.appendColumn(Column(name, 'INTEGER', func=radio.getFunction()))
+ table.appendColumn(
+ Column(
+ name,
+ default_idx is not None and ('INTEGER DEFAULT %d' % default_idx) or 'INTEGER',
+ func=radio.getFunction()))
table.appendConstraint(
- "FOREIGN KEY (%s) REFERENCES %s_tbl (id)" % (name, name))
- table.addDependency("%s_tbl" % name)
+ "FOREIGN KEY (%s) REFERENCES %s (id)" % (name, into))
+ table.addDependency(into)
+
@modeCheck
def _createGroup(self, group):
repeat = group.isRepeat()
More information about the Formed-commits
mailing list