[Mpuls-commits] r4210 - in base/trunk: . mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Nov 16 21:35:27 CET 2010
Author: bh
Date: 2010-11-16 21:35:26 +0100 (Tue, 16 Nov 2010)
New Revision: 4210
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/lib/export.py
Log:
* 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.
(Container.create_tables): Take table names and titles from the
page if one_table_per_page is true. This will automatically put
the values in the right tables on a per-page basis.
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-11-16 20:28:06 UTC (rev 4209)
+++ base/trunk/ChangeLog 2010-11-16 20:35:26 UTC (rev 4210)
@@ -1,5 +1,14 @@
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.
+ (Container.create_tables): Take table names and titles from the
+ page if one_table_per_page is true. This will automatically put
+ the values in the right tables on a per-page basis.
+
+2010-11-16 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/export.py (Container.__init__): New instance
variable field_name_to_table_name to keep track of which fields
belong to which output table.
Modified: base/trunk/mpulsweb/lib/export.py
===================================================================
--- base/trunk/mpulsweb/lib/export.py 2010-11-16 20:28:06 UTC (rev 4209)
+++ base/trunk/mpulsweb/lib/export.py 2010-11-16 20:35:26 UTC (rev 4210)
@@ -82,13 +82,15 @@
"""A container of multiple Table instances"""
- def __init__(self, meta_tree, selection, table_factory):
+ def __init__(self, meta_tree, selection, table_factory,
+ one_table_per_page=False):
"""Initialize the container with a FormEd meta tree and the selection.
"""
self.meta_tree = meta_tree
self.table_factory = table_factory
self.tables = dict()
self.field_name_to_table_name = dict()
+ self.one_table_per_page = one_table_per_page
self.create_tables(selection)
def create_tables(self, selection):
@@ -102,8 +104,12 @@
collector = StructureWidgetCollector()
page.visit(collector.visitor)
for nc in collector.widgets:
- table_name = "master"
- table_title = "Master"
+ if self.one_table_per_page:
+ table_name = page.getName()
+ table_title = page.getDescription()
+ else:
+ table_name = "master"
+ table_title = "Master"
for p in nc.pathToRoot():
if isinstance(p, RepeatNode):
table_name = p.getName()
More information about the Mpuls-commits
mailing list