[Mpuls-commits] r5541 - base/trunk/mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Nov 4 13:30:18 CET 2011
Author: bh
Date: 2011-11-04 13:30:18 +0100 (Fri, 04 Nov 2011)
New Revision: 5541
Modified:
base/trunk/mpulsweb/model/case.py
Log:
Prepare for document export. Move the logbook export hook to a new
method _export_additional_data that can later be extended to also export
the documents attached to a case.
Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py 2011-11-04 11:38:19 UTC (rev 5540)
+++ base/trunk/mpulsweb/model/case.py 2011-11-04 12:30:18 UTC (rev 5541)
@@ -25,6 +25,7 @@
# European Social Fund resources.
# Authors:
# Torsten Irländer <torsten.irlaender at intevation.de>
+# Bernhard Herzog <bernhard.herzog at intevation.de>
#
import logging
@@ -421,13 +422,10 @@
def export(self, type='XML', anonym=True, selection=None):
factory = InstanceFactory(g.formedTree, PostgresDBInterface())
num = 0
- external = None
- if not anonym and "logbook" in selection:
- # Only export logbook when actually selected for export and
- # when the case is not exported anonymized.
- external = export_logbook
+
xmltree = factory.toXML(self.case_list, selection=selection,
- anonymize=anonym, external=external)
+ anonymize=anonym,
+ external=self._export_additional_data)
num = len(self.case_list)
if type == "XML":
@@ -439,6 +437,15 @@
return num, export
+ def _export_additional_data(self, case, case_id, cursor, selection,
+ anonymize):
+ """Export logbook if selected and not anonymizing.
+ """
+ if anonymize:
+ return
+ if "logbook" in selection:
+ export_logbook(case, case_id, cursor, selection, anonymize)
+
def formletter(self, letterid):
factory = g.case_factory
l = []
More information about the Mpuls-commits
mailing list