Browse Source

Fixing import in logger plugins & datasource_plugin

Yann Weber 8 years ago
parent
commit
b44113b74a
3 changed files with 13 additions and 5 deletions
  1. 5
    2
      lodel/logger.py
  2. 5
    3
      lodel/plugin/datasource_plugin.py
  3. 3
    0
      lodel/plugin/plugins.py

+ 5
- 2
lodel/logger.py View File

@@ -19,11 +19,14 @@ logger = logging.getLogger()
19 19
 ##@brief Module initialisation from settings
20 20
 #@return True if inited else False
21 21
 def __init_from_settings():
22
+    from lodel.context import LodelContext
22 23
     try:
23
-        from lodel.settings import Settings
24
+        LodelContext.expose_modules(globals(), {
25
+            'lodel.settings': ['Settings']})
24 26
     except Exception:
25 27
         return False
26
-    from lodel.settings.settings import Settings as Lodel2Settings
28
+    LodelContext.expose_modules(globals(), {
29
+        'lodel.settings.settings': [('Settings', 'Lodel2Settings')]})
27 30
     if not Lodel2Settings.started():
28 31
         return False
29 32
     # capture warning disabled, because the custom format raises error (unable

+ 5
- 3
lodel/plugin/datasource_plugin.py View File

@@ -96,7 +96,7 @@ class DatasourcePlugin(Plugin):
96 96
     _plist_confspecs = {
97 97
         'section': 'lodel2',
98 98
         'key': 'datasource_connectors',
99
-        'default': None,
99
+        'default': 'dummy_datasource',
100 100
         'validator': SettingValidator(
101 101
             'custom_list', none_is_valid = False,
102 102
             validator_name = 'plugin', validator_kwargs = {
@@ -165,7 +165,8 @@ migration handler !!!")
165 165
     #false
166 166
     @staticmethod
167 167
     def plugin_name(ds_name, ro):
168
-        from lodel.settings import Settings
168
+        LodelContext.expose_modules(globals(), {
169
+            'lodel.settings': ['Settings']})
169 170
         # fetching connection identifier given datasource name
170 171
         try:
171 172
             ds_identifier = getattr(Settings.datasources, ds_name)
@@ -201,7 +202,8 @@ DS_PLUGIN_NAME.DS_INSTANCE_NAME. But got %s" % ds_identifier)
201 202
     #@throw NameError if a datasource plugin or instance cannot be found
202 203
     @staticmethod
203 204
     def _get_ds_connection_conf(ds_identifier,ds_plugin_name):
204
-        from lodel.settings import Settings
205
+        LodelContext.expose_modules(globals(), {
206
+            'lodel.settings': ['Settings']})
205 207
         if ds_plugin_name not in Settings.datasource._fields:
206 208
             msg = "Unknown or unconfigured datasource plugin %s"
207 209
             msg %= ds_plugin_name

+ 3
- 0
lodel/plugin/plugins.py View File

@@ -843,6 +843,9 @@ file : '%s'. Running discover again..." % DISCOVER_CACHE_FILENAME)
843 843
     #@return A dict with plugin_name as key and {'path':..., 'version':...} as value
844 844
     @classmethod
845 845
     def _discover(cls, path):
846
+        #Ensure plugins symlink creation
847
+        LodelContext.expose_modules(globals(), {
848
+            'lodel.plugins': 'plugins'})
846 849
         res = []
847 850
         to_explore = [path]
848 851
         while len(to_explore) > 0:

Loading…
Cancel
Save