[Mpuls-commits] r5979 - base/trunk/mpulsweb/lib

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon Jun 11 14:44:33 CEST 2012


Author: bricks
Date: 2012-06-11 14:44:33 +0200 (Mon, 11 Jun 2012)
New Revision: 5979

Modified:
   base/trunk/mpulsweb/lib/app_globals.py
Log:
Add a get_instance_factory method to the globals object

With the current implementation a InstanceFactory object
is created at several places in the mpuls codebase. This
avoids using a special instance tree in a mpuls application
like mpuls_S. Therefore add a central method to receive the
instance factory which can be overriden in a mpuls application.


Modified: base/trunk/mpulsweb/lib/app_globals.py
===================================================================
--- base/trunk/mpulsweb/lib/app_globals.py	2012-06-11 11:13:06 UTC (rev 5978)
+++ base/trunk/mpulsweb/lib/app_globals.py	2012-06-11 12:44:33 UTC (rev 5979)
@@ -32,12 +32,14 @@
 from paste.reloader import watch_file
 from paste.registry import StackedObjectProxy
 
+from formed.instance.backends.postgres import DBFactory as InstanceFactory
 from formed.meta.io.document import openDocument
 
 from libmpuls.service.tags import TagSetterConfig
 
 from mpulsweb.config.importer import import_overridable_module
 from mpulsweb.lib.config import MpulsAppConfig, MpulsDBMapping, MpulsDBList
+from mpulsweb.lib.db import PostgresDBInterface
 from mpulsweb.lib.metaclient import get_ssl_context
 from mpulsweb.model.annotations import AnnotationsProvider
 
@@ -195,5 +197,8 @@
             self.agency_factory.get_search_retrieve_fields(),
             self.agency_factory.get_search_match_fields())
 
+    def get_instance_factory(self):
+        return InstanceFactory(self.formedTree, PostgresDBInterface())
+
     def _get_config(self, filename):
         return MpulsAppConfig(filename)



More information about the Mpuls-commits mailing list