Просмотр исходного кода

Bugfix on lodeladmin allowing to run dyncode update

There is a problem left : when dyncode runs an error is triggered telling
that no active clases were found
Yann Weber 7 лет назад
Родитель
Сommit
6e4942c6a9
2 измененных файлов: 18 добавлений и 22 удалений
  1. 13
    19
      lodel/plugin/core_scripts.py
  2. 5
    3
      progs/slim/install_model/lodel_admin.py

+ 13
- 19
lodel/plugin/core_scripts.py Просмотреть файл

@@ -4,7 +4,7 @@ import tempfile
4 4
 import os, os.path
5 5
 from lodel.context import LodelContext
6 6
 LodelContext.expose_modules(globals(), {
7
-    'lodel.plugin.scripts': 'lodel_script',
7
+    'lodel.plugin.scripts': ['LodelScript'],
8 8
     'lodel.logger': 'logger'})
9 9
 
10 10
 ##@package lodel.plugin.core_scripts
@@ -17,7 +17,7 @@ LodelContext.expose_modules(globals(), {
17 17
 #@ingroup lodel2_plugins
18 18
 #@ingroup lodel2_script
19 19
 #
20
-class ListPlugins(lodel_script.LodelScript):
20
+class ListPlugins(LodelScript):
21 21
     _action = 'plugins-list'
22 22
     _description = "List all installed plugins"
23 23
 
@@ -72,7 +72,7 @@ class ListPlugins(lodel_script.LodelScript):
72 72
 
73 73
 
74 74
 ##@brief Handle install & uninstall of lodel plugins
75
-class PluginManager(lodel_script.LodelScript):
75
+class PluginManager(LodelScript):
76 76
     _action = 'plugins'
77 77
     _description = "Install/Uninstall plugins"
78 78
 
@@ -276,7 +276,7 @@ oprtions. Use -d --directory instead")
276 276
 ##@brief Implements lodel_admin.py **hooks-list** action
277 277
 #@ingroup lodel2_script
278 278
 #@ingroup lodel2_hooks
279
-class ListHooks(lodel_script.LodelScript):
279
+class ListHooks(LodelScript):
280 280
     _action = 'hooks-list'
281 281
     _description = 'Generate a list of registered hooks once instance started'
282 282
 
@@ -302,7 +302,7 @@ class ListHooks(lodel_script.LodelScript):
302 302
             print("\n")
303 303
 
304 304
 
305
-class RefreshDyncode(lodel_script.LodelScript):
305
+class RefreshDyncode(LodelScript):
306 306
     _action = 'dyncode'
307 307
     _description = 'Update the dynamic code according to EM and conf'
308 308
 
@@ -317,6 +317,7 @@ class RefreshDyncode(lodel_script.LodelScript):
317 317
     #multisite instance
318 318
     @classmethod
319 319
     def run(cls, args):
320
+        """
320 321
         #
321 322
         # Dirty hack for instance type detection
322 323
         #
@@ -326,24 +327,17 @@ class RefreshDyncode(lodel_script.LodelScript):
326 327
             print("MONOSITE DETECTED")
327 328
             ctx_type = LodelContext.MONOSITE
328 329
             CONFDIR = os.path.join(os.getcwd(), 'conf.d')
329
-    
330
-        #Bootstraping
331
-        from lodel.context import LodelContext
332
-        LodelContext.init()
333
-        from lodel.settings.settings import Settings as settings_loader
334
-        settings_loader(CONFDIR)
335
-        from lodel.settings import Settings
336
-
337
-        from lodel.editorial_model.model import EditorialModel
338
-        from lodel.leapi import lefactory
339
-
340
-        em_translator = Settings.editorial_model.emtranslator
330
+        """
331
+        LodelContext.expose_modules(globals(), {
332
+            'lodel.settings': ['Settings'],
333
+            'lodel.editorial_model.model': ['EditorialModel']})
334
+        em_translator = Settings.editorialmodel.emtranslator
341 335
         model_file = args.em
342 336
         if len(args.em.strip()) == 0:
343 337
             #using the default em_file
344
-            model_file = Settings.editorial_model.emfile
338
+            model_file = Settings.editorialmodel.emfile
345 339
         #Model loaded
346
-        model = EditorialModel.load(translator, filename = model_file)
340
+        model = EditorialModel.load(em_translator, filename = model_file)
347 341
         #Creating dyncode
348 342
         dyncode_file = Settings.editorial_model.dyncode
349 343
         dyncode_content = lefactory.dyncode_from(model)

+ 5
- 3
progs/slim/install_model/lodel_admin.py Просмотреть файл

@@ -145,7 +145,9 @@ if __name__ == '__main__':
145 145
         bootstrap.bootstrap('lodelsites')
146 146
     else:
147 147
         bootstrap.bootstrap()
148
-    #import loader
149
-    #loader.start()
150
-    from lodel.plugin.scripts import main_run
148
+    from lodel.context import LodelContext
149
+    #from lodel.plugin.scripts import main_run
150
+    LodelContext.expose_modules(globals(),
151
+        {'lodel.plugin.scripts': ['main_run'],
152
+         'lodel.plugin.core_scripts': 'core_scripts'})
151 153
     main_run()

Загрузка…
Отмена
Сохранить