|
@@ -7,7 +7,7 @@ import shutil
|
7
|
7
|
from lodel.context import LodelContext
|
8
|
8
|
from lodel import buildconf #No need to protect it in Contexts
|
9
|
9
|
|
10
|
|
-LodelContext.expose_module(globals(), {
|
|
10
|
+LodelContext.expose_modules(globals(), {
|
11
|
11
|
'lodel.plugin.datasource_plugin': ['AbstractDatasource', 'DatasourcePlugin'],
|
12
|
12
|
'lodel.exceptions': ['LodelFatalError'],
|
13
|
13
|
'lodel.settings': 'Settings'})
|
|
@@ -16,7 +16,7 @@ from .exceptions import *
|
16
|
16
|
|
17
|
17
|
LODELSITE_DATAS_PATH = os.path.join(buildconf.LODEL2VARDIR,'sites_datas')
|
18
|
18
|
LODELSITE_CONTEXTS_PATH = os.path.join(
|
19
|
|
- buildconf.LODEL2VARDIRE, '.sites_contexts')
|
|
19
|
+ buildconf.LODEL2VARDIR, '.sites_contexts')
|
20
|
20
|
|
21
|
21
|
##@brief Define directories architecture
|
22
|
22
|
#
|
|
@@ -46,14 +46,14 @@ def name2paths(name):
|
46
|
46
|
def site_exists(name):
|
47
|
47
|
paths = name2paths(name)
|
48
|
48
|
for path in paths:
|
49
|
|
- if os.path.is_file(path):
|
|
49
|
+ if os.path.isfile(path):
|
50
|
50
|
msg = 'Will trying to determine if a lodesite "%s" exists we \
|
51
|
51
|
found that "%s" is a file, but a directory was expected' % (name, path)
|
52
|
52
|
raise LodelSiteDatasourceInconsistency(msg)
|
53
|
53
|
|
54
|
54
|
res = [False, False]
|
55
|
|
- res = [os.is_dir(paths[0]),
|
56
|
|
- os.is_dir(paths[1])]
|
|
55
|
+ res = [os.path.isdir(paths[0]),
|
|
56
|
+ os.path.isdir(paths[1])]
|
57
|
57
|
if res[0] != res[1]:
|
58
|
58
|
msg = 'Inconsistency detected on filesystem will trying to determine \
|
59
|
59
|
wether a lodelsite exists or not : '
|
|
@@ -81,24 +81,24 @@ allready exists' % name)
|
81
|
81
|
try:
|
82
|
82
|
os.mkdir(data_path)
|
83
|
83
|
except FileExistsError:
|
84
|
|
- logger.fatal('This should never append ! We just checked that this \
|
|
84
|
+ logger.critical('This should never append ! We just checked that this \
|
85
|
85
|
directory do not exists. BAILOUT !')
|
86
|
86
|
raise LodelFatalError('Unable to create data directory for lodelsite \
|
87
|
87
|
"%s", file exists')
|
88
|
88
|
except Exception as e:
|
89
|
|
- raise LodelFataError(('Unable to create data directory for lodelsite \
|
90
|
|
-"%s" : ' % name) + e)
|
|
89
|
+ raise LodelFatalError('Unable to create data directory for lodelsite \
|
|
90
|
+"%s" : %s' % (name,e))
|
91
|
91
|
#Context dir
|
92
|
92
|
try:
|
93
|
93
|
os.mkdir(ctx_path)
|
94
|
|
- except FileExistsErrpr:
|
95
|
|
- logger.fatal('This should never append ! We just checked that this \
|
|
94
|
+ except FileExistsError:
|
|
95
|
+ logger.critical('This should never append ! We just checked that this \
|
96
|
96
|
directory do not exists. BAILOUT !')
|
97
|
97
|
raise LodelFatalError('Unable to create context directory for \
|
98
|
98
|
lodelsite "%s", file exists')
|
99
|
99
|
except Exception as e:
|
100
|
|
- raise LodelFataError(('Unable to create context directory for \
|
101
|
|
-lodelsite "%s" : ' % name) + e)
|
|
100
|
+ raise LodelFatalError('Unable to create context directory for \
|
|
101
|
+lodelsite "%s" : %s' % (name, e))
|
102
|
102
|
|
103
|
103
|
#Child directories
|
104
|
104
|
for mname, ccd in (('datas', data_path), ('ctx', ctx_path)):
|
|
@@ -108,11 +108,11 @@ lodelsite "%s" : ' % name) + e)
|
108
|
108
|
try:
|
109
|
109
|
os.mkdir(to_create)
|
110
|
110
|
except FileExistsError:
|
111
|
|
- logger.fatal('This should never append ! We just created parent \
|
|
111
|
+ logger.critical('This should never append ! We just created parent \
|
112
|
112
|
directory. BAILOUT !')
|
113
|
113
|
except Exception as e:
|
114
|
|
- raise LodelFatalError(('Unable to create %s directory for \
|
115
|
|
-lodelsite "%s" : ' % (d,name)) + e)
|
|
114
|
+ raise LodelFatalError('Unable to create %s directory for \
|
|
115
|
+lodelsite "%s" : %s' % (d,name, e))
|
116
|
116
|
|
117
|
117
|
##@brief Generate conffile containing informations set by lodelsites EM
|
118
|
118
|
#
|