|
@@ -168,15 +168,21 @@ def directory_val(value):
|
168
|
168
|
def loglevel_val(value):
|
169
|
169
|
valids = ['DEBUG', 'INFO', 'SECURITY', 'ERROR', 'CRITICAL']
|
170
|
170
|
if value.upper() not in valids:
|
171
|
|
- raise SettingsValidationError("The value '%s' is not a valid loglevel")
|
|
171
|
+ raise SettingsValidationError(
|
|
172
|
+ "The value '%s' is not a valid loglevel" % value)
|
172
|
173
|
return value.upper()
|
173
|
174
|
|
174
|
175
|
def path_val(value):
|
|
176
|
+ print("DEBUG",os.getcwd())
|
175
|
177
|
if not os.path.exists(value):
|
176
|
|
- raise SettingsValidationError("The value '%s' is not a valid path")
|
|
178
|
+ raise SettingsValidationError(
|
|
179
|
+ "path '%s' doesn't exists" % value)
|
177
|
180
|
return value
|
178
|
181
|
|
179
|
|
-def dummy_val(value): return value
|
|
182
|
+def none_val(value):
|
|
183
|
+ if value is None:
|
|
184
|
+ return None
|
|
185
|
+ raise SettingsValidationError("This settings cannot be set in configuration file")
|
180
|
186
|
|
181
|
187
|
#
|
182
|
188
|
# Default validators registration
|
|
@@ -184,9 +190,14 @@ def dummy_val(value): return value
|
184
|
190
|
|
185
|
191
|
SettingValidator.register_validator(
|
186
|
192
|
'dummy',
|
187
|
|
- dummy_val,
|
|
193
|
+ lambda value:value,
|
188
|
194
|
'Validate anything')
|
189
|
195
|
|
|
196
|
+SettingValidator.register_validator(
|
|
197
|
+ 'none',
|
|
198
|
+ none_val,
|
|
199
|
+ 'Validate None')
|
|
200
|
+
|
190
|
201
|
SettingValidator.register_validator(
|
191
|
202
|
'strip',
|
192
|
203
|
str.strip,
|