|
@@ -17,7 +17,7 @@ LodelContext.expose_modules(globals(), {
|
17
|
17
|
'LeApiQueryErrors'],
|
18
|
18
|
'lodel.plugin.exceptions': ['PluginError', 'PluginTypeError',
|
19
|
19
|
'LodelScriptError', 'DatasourcePluginError'],
|
20
|
|
- 'lodel.exceptions': ['LodelFatalError'],
|
|
20
|
+ 'lodel.exceptions': ['LodelFatalError', 'LodelFatalErrors'],
|
21
|
21
|
'lodel.plugin.hooks': ['LodelHook'],
|
22
|
22
|
'lodel.plugin': ['Plugin', 'DatasourcePlugin'],
|
23
|
23
|
'lodel.leapi.datahandlers.base_classes': ['DatasConstructor', 'Reference']})
|
|
@@ -270,26 +270,31 @@ class LeObject(object):
|
270
|
270
|
rw_ds = ro_ds = cls._datasource_name
|
271
|
271
|
else:
|
272
|
272
|
ro_ds, rw_ds = cls._datasource_name
|
|
273
|
+ errors = []
|
273
|
274
|
# Read only datasource initialisation
|
274
|
|
- cls._ro_datasource = DatasourcePlugin.init_datasource(ro_ds, True)
|
275
|
|
- if cls._ro_datasource is None:
|
276
|
|
- log_msg = "No read only datasource set for LeObject %s"
|
277
|
|
- log_msg %= cls.__name__
|
278
|
|
- logger.error(log_msg)
|
279
|
|
- else:
|
280
|
|
- log_msg = "Read only datasource '%s' initialized for LeObject %s"
|
281
|
|
- log_msg %= (ro_ds, cls.__name__)
|
282
|
|
- logger.debug(log_msg)
|
|
275
|
+ try:
|
|
276
|
+ cls._ro_datasource = DatasourcePlugin.init_datasource(ro_ds, True)
|
|
277
|
+ if cls._ro_datasource is not None:
|
|
278
|
+ log_msg = "Read only datasource '%s' initialized for LeObject %s"
|
|
279
|
+ log_msg %= (ro_ds, cls.__name__)
|
|
280
|
+ logger.debug(log_msg)
|
|
281
|
+ except LodelFatalError as e:
|
|
282
|
+ errors.append(e)
|
|
283
|
+
|
283
|
284
|
# Read write datasource initialisation
|
284
|
|
- cls._rw_datasource = DatasourcePlugin.init_datasource(rw_ds, False)
|
285
|
|
- if cls._ro_datasource is None:
|
286
|
|
- log_msg = "No read/write datasource set for LeObject %s"
|
287
|
|
- log_msg %= cls.__name__
|
288
|
|
- logger.error(log_msg)
|
289
|
|
- else:
|
290
|
|
- log_msg = "Read/write datasource '%s' initialized for LeObject %s"
|
291
|
|
- log_msg %= (ro_ds, cls.__name__)
|
292
|
|
- logger.debug(log_msg)
|
|
285
|
+ try:
|
|
286
|
+ cls._rw_datasource = DatasourcePlugin.init_datasource(rw_ds, False)
|
|
287
|
+ if cls._ro_datasource is not None:
|
|
288
|
+ log_msg = "Read/write datasource '%s' initialized for LeObject %s"
|
|
289
|
+ log_msg %= (ro_ds, cls.__name__)
|
|
290
|
+ logger.debug(log_msg)
|
|
291
|
+ except LodelFatalError as e:
|
|
292
|
+ errors.append(e)
|
|
293
|
+
|
|
294
|
+ if len(errors) > 0:
|
|
295
|
+ raise LodelFatalErrors(msg = 'Unable to instanciate datasources \
|
|
296
|
+for LeObject %s' % cls.__name__, exceptions = errors)
|
|
297
|
+
|
293
|
298
|
|
294
|
299
|
# @brief Return the uid of the current LeObject instance
|
295
|
300
|
#@return the uid value
|