Browse Source

Bugfix in LeObject._datasource bootstraping

- now _datasource attr contains an instance of the datasource, instanciated with options given in conf file
Yann Weber 9 years ago
parent
commit
065912cc66
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      lodel/leapi/leobject.py

+ 7
- 1
lodel/leapi/leobject.py View File

@@ -223,12 +223,18 @@ class LeObject(object):
223 223
         #Checks that the datasource plugin exists
224 224
         ds_plugin_module = Plugins.plugin_module(ds_plugin)
225 225
         try:
226
-            cls._datasource = getattr(ds_plugin_module, "Datasource")
226
+            datasource_class = getattr(ds_plugin_module, "Datasource")
227 227
         except AttributeError as e:
228 228
             raise e
229 229
             expt_msg += "The datasource plugin %s seems to be invalid. Error raised when trying to import Datasource"
230 230
             expt_msg %= ds_identifier
231 231
             raise SettingsError(expt_msg)
232
+        ds_conf_old = ds_conf
233
+        ds_conf = dict()
234
+        for k in ds_conf_old._fields:
235
+            ds_conf[k] = getattr(ds_conf_old, k)
236
+
237
+        cls._datasource = datasource_class(**ds_conf)
232 238
         log_msg = "Datasource %s initialized for LeObject %s"
233 239
         log_msg %= (datasource_orig_name, cls.__name__)
234 240
         logger.debug(log_msg)

Loading…
Cancel
Save