|
@@ -37,26 +37,6 @@ import lodel.buildconf
|
37
|
37
|
#@todo use the dyncode getter when it will be available (replaced by
|
38
|
38
|
#the string SUPERDYNCODE_ACCESSOR.Lodelsite for the moment)
|
39
|
39
|
def main():
|
40
|
|
- """
|
41
|
|
- LodelContext.set(None)
|
42
|
|
- LodelContext.expose_modules(globals(), {
|
43
|
|
- 'lodel.logger': 'logger',
|
44
|
|
- 'lodel.exceptions': ['LodelFatalError'],
|
45
|
|
- })
|
46
|
|
-
|
47
|
|
- CONFDIR = os.path.join(os.getcwd(), SERVER_CONFD)
|
48
|
|
- if not os.path.isdir(CONFDIR):
|
49
|
|
- logger.critical('Multisite process bootstraping fails : unable to \
|
50
|
|
-find the %s folder' % SERVER_CONFD)
|
51
|
|
-
|
52
|
|
- #Settings bootstraping for mutlisite process
|
53
|
|
- LodelContext.expose_modules(globals(), {
|
54
|
|
- 'lodel.settings.settings': [('Settings', 'settings')],
|
55
|
|
- 'lodel.plugins.multisite.confspecs': 'multisite_confspecs'})
|
56
|
|
- settings(CONFDIR, multisite_confspecs.LODEL2_CONFSPECS)
|
57
|
|
- #Loading settings
|
58
|
|
- del(globals()['settings']) #useless but may be safer
|
59
|
|
- """
|
60
|
40
|
#Set current context to reserved loader context
|
61
|
41
|
from lodel import bootstrap
|
62
|
42
|
bootstrap.bootstrap('__loader__')
|
|
@@ -81,6 +61,15 @@ find the %s folder' % SERVER_CONFD)
|
81
|
61
|
'lodel.settings': ['Settings']})
|
82
|
62
|
|
83
|
63
|
LodelContext.expose_dyncode(globals())
|
|
64
|
+
|
|
65
|
+ LodelContext.expose_modules(globals(), {
|
|
66
|
+ 'lodel.logger': 'logger',
|
|
67
|
+ 'lodel.plugin.hooks': ['LodelHook'],
|
|
68
|
+ 'lodel.plugin': ['Plugin']})
|
|
69
|
+ Plugin.load_all()
|
|
70
|
+ LodelHook.call_hook('lodel2_bootstraped', '__main__', None)
|
|
71
|
+
|
|
72
|
+
|
84
|
73
|
lodelsite_leo = leapi_dyncode.Lodelsite #hardcoded leo name
|
85
|
74
|
LodelContext.expose_modules(globals(), {
|
86
|
75
|
'lodel.leapi.query': ['LeGetQuery'],
|
|
@@ -88,16 +77,21 @@ find the %s folder' % SERVER_CONFD)
|
88
|
77
|
#the line bellow you will find another harcoded thing : the shortname
|
89
|
78
|
#fieldname for a lodelsite
|
90
|
79
|
handled_sites = LeGetQuery(lodelsite_leo, query_filters = [],
|
91
|
|
- field_list = ['shortname'])
|
|
80
|
+ field_list = ['shortname']).execute()
|
92
|
81
|
#Now that we have the handled sitenames list we can go back to
|
93
|
82
|
#loader context and clean it
|
|
83
|
+ if handled_sites is not None:
|
|
84
|
+ LodelContext.set(None)
|
|
85
|
+ for mname in ['LeGetQuery', 'Settings', 'LodelHook', 'Plugin', 'logger']:
|
|
86
|
+ del(globals()[mname])
|
|
87
|
+ #Loading handled sites
|
|
88
|
+ for handled_sitename in [s['shortname'] for s in handled_sites]:
|
|
89
|
+ datapath = os.path.join(lodelsites_datapath, handled_sitename)
|
|
90
|
+ site_load(datapath) #using default conf.d configuration dirname
|
|
91
|
+ else:
|
|
92
|
+ logger.warning("No handled sites !")
|
94
|
93
|
LodelContext.set(None)
|
95
|
|
- for mname in ['LeGetQuery', 'Settings']:
|
96
|
|
- del(globals()[mname])
|
97
|
|
- #Loading handled sites
|
98
|
|
- for handled_sitename in [s['shortname'] for s in handled_sites]:
|
99
|
|
- datapath = os.path.join(lodelsites_datapath, handled_sitename)
|
100
|
|
- site_load(datapath) #using default conf.d configuration dirname
|
|
94
|
+
|
101
|
95
|
|
102
|
96
|
|
103
|
97
|
##@brief Load a site
|