소스 검색

Merge branch 'context_manager_poc' of git.labocleo.org:lodel2 into context_manager_poc

Conflicts:
	lodel/plugins/multisite/loader.py
Yann Weber 8 년 전
부모
커밋
2195ca15af
1개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 9
    6
      lodel/plugins/multisite/loader.py

+ 9
- 6
lodel/plugins/multisite/loader.py 파일 보기

@@ -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)

Loading…
취소
저장