[Mpuls-commits] r3461 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Aug 27 12:15:08 CEST 2010


Author: bh
Date: 2010-08-27 12:15:04 +0200 (Fri, 27 Aug 2010)
New Revision: 3461

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/app_globals.py
Log:
* mpulsweb/lib/app_globals.py (Globals._init_case_): Add default
implementation of this method.  All derived mpuls applications
implement this method in almost the same way.  The only difference
between the applications the name of the top-level package they
import the modules from.  To avoid duplication of code, implement
the same functionality in the mpuls base and use
import_overridable_module to import the application specific
modules.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-27 09:29:21 UTC (rev 3460)
+++ base/trunk/ChangeLog	2010-08-27 10:15:04 UTC (rev 3461)
@@ -1,3 +1,14 @@
+2010-08-27  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/app_globals.py (Globals._init_case_): Add default
+	implementation of this method.  All derived mpuls applications
+	implement this method in almost the same way.  The only difference
+	between the applications the name of the top-level package they
+	import the modules from.  To avoid duplication of code, implement
+	the same functionality in the mpuls base and use
+	import_overridable_module to import the application specific
+	modules.
+
 2010-08-26  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/lib/search.py (SEARCH_QUERY, SEARCH_FIELDS)

Modified: base/trunk/mpulsweb/lib/app_globals.py
===================================================================
--- base/trunk/mpulsweb/lib/app_globals.py	2010-08-27 09:29:21 UTC (rev 3460)
+++ base/trunk/mpulsweb/lib/app_globals.py	2010-08-27 10:15:04 UTC (rev 3461)
@@ -36,6 +36,7 @@
 
 from libmpuls.service.tags import TagSetterConfig
 
+from mpulsweb.config.importer import import_overridable_module
 from mpulsweb.lib.timelog import setupTimeLogging
 from mpulsweb.lib.config import MpulsAppConfig, MpulsDBMapping
 from mpulsweb.model.annotations import AnnotationsProvider
@@ -116,3 +117,14 @@
             setupTimeLogging(time_host, int(time_port))
         elif time_host:
             setupTimeLogging(int(time_host))
+
+        self._init_case()
+
+    def _init_case(self):
+        """Set the mpuls application specific case classes"""
+        case_module = import_overridable_module("model.case")
+        self.case = case_module.Case
+        self.case.set_fields(self.mpuls_config.get("case", "fields"))
+        self.case_factory = case_module.CaseFactory(self.case)
+        search_module = import_overridable_module("lib.search")
+        self.case_search  = search_module.CaseSearch



More information about the Mpuls-commits mailing list