Browse Source

Bugfix in various loader & bootstrap functions

Now we are able to generate dyncode for lodelsites and handled sites (
tested with only 1 handled site) using lodel_admin.py dyncode -a
Yann Weber 7 years ago
parent
commit
56cd806ceb

+ 6
- 4
lodel/bootstrap.py View File

@@ -141,7 +141,9 @@ def site_preload(data_path, confdir_basename = 'conf.d', lodelsites_instance = F
141 141
         LodelFatalError('Bad argument given to site_load(). This really \
142 142
 sux !')
143 143
     #Determining uniq sitename from data_path
144
-    data_path = os.path.dirname(data_path).rstrip('/') #else basename returns ''
144
+    data_path = data_path.rstrip('/')
145
+    if lodelsites_instance:
146
+        data_path = os.path.dirname(data_path).rstrip('/')
145 147
     ctx_name = os.path.basename(data_path)
146 148
     if not os.path.exists(data_path) or not os.path.isdir(data_path):
147 149
         LodelContext.expose_modules(globals(), {
@@ -150,7 +152,7 @@ sux !')
150 152
     #Immediately switching to the context
151 153
     LodelContext.new(ctx_name)
152 154
     LodelContext.set(ctx_name)
153
-    os.chdir(data_path) #Now the confdir is ./$condir_basename
155
+    confdir = os.path.join(data_path, confdir_basename)
154 156
     #Loading settings for current site
155 157
     LodelContext.expose_modules(globals(), {
156 158
         'lodel.settings.settings': [('Settings', 'settings_preloader')]})
@@ -164,10 +166,10 @@ This should not append !' % ctx_name
164 166
     if lodelsites_instance:
165 167
         #fetching custom confspec
166 168
         custom_confspec = _get_confspec("dummy_argument_is_obsolete")
167
-        settings_preloader(os.path.join('./', confdir_basename),
169
+        settings_preloader(os.path.join('./', confdir),
168 170
             custom_confspec, True)
169 171
     else:
170
-        settings_preloader(os.path.join('./', confdir_basename))
172
+        settings_preloader(os.path.join('./', confdir))
171 173
     LodelContext.set(None)
172 174
     return
173 175
 

+ 4
- 2
lodel/plugin/core_scripts.py View File

@@ -365,15 +365,17 @@ class RefreshDyncode(LodelScript):
365 365
             })
366 366
             handled_sites = get_handled_sites_name()
367 367
             del(globals()['get_handled_sites_name'])
368
-            lodlesites_path = os.path.join(buildconf.LODEL2VARDIR,
368
+            lodlesites_path = os.path.join(
369
+                os.path.join(buildconf.LODEL2VARDIR, lodelsites_name),
369 370
                 buildconf.MULTISITE_CONTEXTDIR)
370 371
             if handled_sites is not None:
371 372
                 for sitename in handled_sites:
372 373
                     LodelContext.set(None)
373 374
                     #construct dyncode filename
375
+                    ##@todo fetch dyncode filename from handled site conf
374 376
                     dyncode_path = os.path.join(
375 377
                         os.path.join(lodlesites_path, sitename),
376
-                        'leapi_dyncode') #BOO hardcoded dyncode file name
378
+                        'leapi_dyncode.py') #BOO hardcoded dyncode file name
377 379
                     cls.refresh_dyncode(emfile_path, dyncode_path,
378 380
                         em_translator)
379 381
         #Refresh only one dyncode

+ 3
- 0
lodel/settings/settings_loader.py View File

@@ -25,6 +25,9 @@ class SettingsLoader(object):
25 25
     # @param conf_path str : conf.d path
26 26
     def __init__(self, conf_path):
27 27
         self.__conf_path = conf_path
28
+        if not os.path.isdir(conf_path):
29
+            logger.warning("Configuration directory %s do not exists. Using \
30
+default configuration values (cwd : %s)" % (conf_path, os.getcwd()))
28 31
         self.__conf_sv = dict()
29 32
         self.__conf = self.__merge()
30 33
         # Stores errors

+ 1
- 3
progs/slim/install_model/lodel_admin.py View File

@@ -172,9 +172,7 @@ leapi_dyncode. Abording handled sites preloading")
172 172
         del(globals()['logger'])
173 173
         del(globals()['LodelException'])
174 174
         for sitename in handled_sites:
175
-            datapath = os.path.join(
176
-                os.path.join(lodel.buildconf.LODEL2VARDIR, sitename),
177
-                lodel.buildconf.MULTISITE_DATADIR)
175
+            datapath = os.path.join(lodelsites_datapath, sitename)
178 176
             site_preload(datapath)
179 177
     else:
180 178
         bootstrap.bootstrap()

Loading…
Cancel
Save