mirror of
https://github.com/yweber/lodel2.git
synced 2025-11-12 17:09:16 +01:00
Fixing multisite loader
Now it seems to work. Tested using : dummy datasource, no handled sites, ipython ui
This commit is contained in:
parent
95305a88ba
commit
5467df8184
2 changed files with 23 additions and 29 deletions
|
|
@ -275,7 +275,7 @@ class LeObject(object):
|
|||
if cls._ro_datasource is None:
|
||||
log_msg = "No read only datasource set for LeObject %s"
|
||||
log_msg %= cls.__name__
|
||||
logger.debug(log_msg)
|
||||
logger.error(log_msg)
|
||||
else:
|
||||
log_msg = "Read only datasource '%s' initialized for LeObject %s"
|
||||
log_msg %= (ro_ds, cls.__name__)
|
||||
|
|
@ -285,7 +285,7 @@ class LeObject(object):
|
|||
if cls._ro_datasource is None:
|
||||
log_msg = "No read/write datasource set for LeObject %s"
|
||||
log_msg %= cls.__name__
|
||||
logger.debug(log_msg)
|
||||
logger.error(log_msg)
|
||||
else:
|
||||
log_msg = "Read/write datasource '%s' initialized for LeObject %s"
|
||||
log_msg %= (ro_ds, cls.__name__)
|
||||
|
|
|
|||
|
|
@ -37,26 +37,6 @@ import lodel.buildconf
|
|||
#@todo use the dyncode getter when it will be available (replaced by
|
||||
#the string SUPERDYNCODE_ACCESSOR.Lodelsite for the moment)
|
||||
def main():
|
||||
"""
|
||||
LodelContext.set(None)
|
||||
LodelContext.expose_modules(globals(), {
|
||||
'lodel.logger': 'logger',
|
||||
'lodel.exceptions': ['LodelFatalError'],
|
||||
})
|
||||
|
||||
CONFDIR = os.path.join(os.getcwd(), SERVER_CONFD)
|
||||
if not os.path.isdir(CONFDIR):
|
||||
logger.critical('Multisite process bootstraping fails : unable to \
|
||||
find the %s folder' % SERVER_CONFD)
|
||||
|
||||
#Settings bootstraping for mutlisite process
|
||||
LodelContext.expose_modules(globals(), {
|
||||
'lodel.settings.settings': [('Settings', 'settings')],
|
||||
'lodel.plugins.multisite.confspecs': 'multisite_confspecs'})
|
||||
settings(CONFDIR, multisite_confspecs.LODEL2_CONFSPECS)
|
||||
#Loading settings
|
||||
del(globals()['settings']) #useless but may be safer
|
||||
"""
|
||||
#Set current context to reserved loader context
|
||||
from lodel import bootstrap
|
||||
bootstrap.bootstrap('__loader__')
|
||||
|
|
@ -81,6 +61,15 @@ find the %s folder' % SERVER_CONFD)
|
|||
'lodel.settings': ['Settings']})
|
||||
|
||||
LodelContext.expose_dyncode(globals())
|
||||
|
||||
LodelContext.expose_modules(globals(), {
|
||||
'lodel.logger': 'logger',
|
||||
'lodel.plugin.hooks': ['LodelHook'],
|
||||
'lodel.plugin': ['Plugin']})
|
||||
Plugin.load_all()
|
||||
LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
|
||||
|
||||
|
||||
lodelsite_leo = leapi_dyncode.Lodelsite #hardcoded leo name
|
||||
LodelContext.expose_modules(globals(), {
|
||||
'lodel.leapi.query': ['LeGetQuery'],
|
||||
|
|
@ -88,16 +77,21 @@ find the %s folder' % SERVER_CONFD)
|
|||
#the line bellow you will find another harcoded thing : the shortname
|
||||
#fieldname for a lodelsite
|
||||
handled_sites = LeGetQuery(lodelsite_leo, query_filters = [],
|
||||
field_list = ['shortname'])
|
||||
field_list = ['shortname']).execute()
|
||||
#Now that we have the handled sitenames list we can go back to
|
||||
#loader context and clean it
|
||||
if handled_sites is not None:
|
||||
LodelContext.set(None)
|
||||
for mname in ['LeGetQuery', 'Settings', 'LodelHook', 'Plugin', 'logger']:
|
||||
del(globals()[mname])
|
||||
#Loading handled sites
|
||||
for handled_sitename in [s['shortname'] for s in handled_sites]:
|
||||
datapath = os.path.join(lodelsites_datapath, handled_sitename)
|
||||
site_load(datapath) #using default conf.d configuration dirname
|
||||
else:
|
||||
logger.warning("No handled sites !")
|
||||
LodelContext.set(None)
|
||||
for mname in ['LeGetQuery', 'Settings']:
|
||||
del(globals()[mname])
|
||||
#Loading handled sites
|
||||
for handled_sitename in [s['shortname'] for s in handled_sites]:
|
||||
datapath = os.path.join(lodelsites_datapath, handled_sitename)
|
||||
site_load(datapath) #using default conf.d configuration dirname
|
||||
|
||||
|
||||
|
||||
##@brief Load a site
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue