|
@@ -9,13 +9,8 @@ except ImportError:
|
9
|
9
|
from lodel.context import LodelContext
|
10
|
10
|
|
11
|
11
|
def preload():
|
12
|
|
- # TODO Get this path dynamically but should be ./ everytime (we run
|
13
|
|
- #the loader from the good folder)
|
14
|
|
- LODEL_INSTANCE_DIR = './'
|
15
|
|
- LodelContext.init(LodelContext.MULTISITE)
|
16
|
|
- lodelsites_list = [sitename for sitename in os.listdir(LODEL_INSTANCES_DIR) if os.path.isdir(sitename)]
|
17
|
12
|
|
18
|
|
- for lodelsite_path in lodelsites_list:
|
|
13
|
+ for lodelcontext in LodelContext._contexts.values():
|
19
|
14
|
ctx_name = LodelContext.from_path(lodelsite_path)
|
20
|
15
|
#Switch to new context
|
21
|
16
|
LodelContext.set(ctx_name)
|
|
@@ -33,5 +28,13 @@ def preload():
|
33
|
28
|
'lodel.plugin.core_hooks': 'core_hooks',
|
34
|
29
|
'lodel.plugin.core_scripts': 'core_scripts'
|
35
|
30
|
})
|
|
31
|
+
|
|
32
|
+ #Load plugins
|
|
33
|
+ lodelcontext.expose_modules(globals(), {
|
|
34
|
+ 'lodel.logger': 'logger',
|
|
35
|
+ 'lodel.plugin': ['Plugin']})
|
|
36
|
+ logger.debug("Loader.start() called")
|
|
37
|
+ Plugin.load_all()
|
|
38
|
+ LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
|
36
|
39
|
#switch back to loader context
|
37
|
40
|
LodelContext.set(None)
|