[Mpuls-commits] r4211 - in base/trunk: . mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Nov 16 21:38:06 CET 2010
Author: bh
Date: 2010-11-16 21:38:05 +0100 (Tue, 16 Nov 2010)
New Revision: 4211
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/lib/export.py
Log:
* mpulsweb/lib/export.py (Container.__init__): New instance
variable table_order to keep track of the order in which the table
occur in the formed definition, so that the order of the sheets in
the XLS export can be the same as in the forms in the
web-application.
(Container.create_tables): Fill table_order.
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-11-16 20:35:26 UTC (rev 4210)
+++ base/trunk/ChangeLog 2010-11-16 20:38:05 UTC (rev 4211)
@@ -1,5 +1,14 @@
2010-11-16 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/lib/export.py (Container.__init__): New instance
+ variable table_order to keep track of the order in which the table
+ occur in the formed definition, so that the order of the sheets in
+ the XLS export can be the same as in the forms in the
+ web-application.
+ (Container.create_tables): Fill table_order.
+
+2010-11-16 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/export.py (Container.__init__): New parameter and
instance one_table_per_page (default False) to indicate whether
there should be one table per FormEd page. Needed for XLS export.
Modified: base/trunk/mpulsweb/lib/export.py
===================================================================
--- base/trunk/mpulsweb/lib/export.py 2010-11-16 20:35:26 UTC (rev 4210)
+++ base/trunk/mpulsweb/lib/export.py 2010-11-16 20:38:05 UTC (rev 4211)
@@ -90,6 +90,7 @@
self.table_factory = table_factory
self.tables = dict()
self.field_name_to_table_name = dict()
+ self.table_order = []
self.one_table_per_page = one_table_per_page
self.create_tables(selection)
@@ -97,6 +98,9 @@
table_columns = dict()
repeat_groups = set()
titles = dict()
+ table_order = []
+ if not self.one_table_per_page:
+ table_order.append("master")
for page in self.meta_tree.findAllByClass(PageNode):
if page.getName() not in selection:
continue
@@ -116,6 +120,9 @@
table_title = p.getDescription()
repeat_groups.add(table_name)
break
+
+ if table_name not in table_columns:
+ table_order.append(table_name)
table_columns.setdefault(table_name, []).append(nc.getName())
titles[table_name] = table_title
@@ -128,6 +135,8 @@
for column_name in columns:
self.field_name_to_table_name[column_name] = name
+ self.table_order = table_order
+
def fill(self, tree):
"""Fill the tables with the contents of the ElementTree tree."""
self.repeat_group_ids = itertools.count()
More information about the Mpuls-commits
mailing list