[Mpuls-commits] r5736 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Dec 22 15:44:26 CET 2011


Author: torsten
Date: 2011-12-22 15:44:25 +0100 (Thu, 22 Dec 2011)
New Revision: 5736

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
Use default values from mpuls config instead of hard coded values


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-12-22 14:38:22 UTC (rev 5735)
+++ base/trunk/mpulsweb/model/case.py	2011-12-22 14:44:25 UTC (rev 5736)
@@ -49,7 +49,8 @@
 from mpulsweb.lib.base import g, h, session
 from mpulsweb.lib.export import XLSExport, CSVExport
 from mpulsweb.lib.anonymize import determineAnonymizedCaseEndPhase
-from mpulsweb.lib.helpers import ensure_unicode, format_date, get_TagSetter
+from mpulsweb.lib.helpers import ensure_unicode, format_date, get_TagSetter, \
+dd_mm_YYYY
 from mpulsweb.lib.db import PostgresDBInterface, db
 
 from mpulsweb.model.document import listDocuments, export_documents, \
@@ -128,15 +129,18 @@
     """Will return the default value for a instance tree item"""
     meta = item.getMeta()
     if isinstance(meta, DateLeaf):
-        value = 'unbekannt'
+        default = g.mpuls_config.get('case', 'default-autocomplete-date')
+        if default == "NOW":
+            default = dd_mm_YYYY(datetime.today())
+        value = default
     elif isinstance(meta, IntLeaf):
-       value = '-9999999'
+        value = g.mpuls_config.get('case', 'default-autocomplete-integer')
     elif isinstance(meta, TextLeaf):
-       value = 'unbekannt'
+        value = g.mpuls_config.get('case', 'default-autocomplete-text')
     elif isinstance(meta, ChoiceNode):
-       value = '-3'
+        value = g.mpuls_config.get('case', 'default-autocomplete-choice')
     else:
-       value = None
+        value = None
     return value
 
 def get_field_identifier(id, name, it=None, idx=0):



More information about the Mpuls-commits mailing list