Browse Source

Bugfixes on SettingValidator class

Yann Weber 8 years ago
parent
commit
4507b22fad
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      lodel/settings/validator.py

+ 3
- 3
lodel/settings/validator.py View File

@@ -7,6 +7,8 @@ import socket
7 7
 import inspect
8 8
 import copy
9 9
 
10
+from lodel.exceptions import *
11
+
10 12
 ## @package lodel.settings.validator Lodel2 settings validators/cast module
11 13
 #
12 14
 # Validator are registered in the SettingValidator class.
@@ -33,7 +35,7 @@ class SettingValidator(object):
33 35
     #@param **kwargs : more arguement for the validator
34 36
     def __init__(self, name, none_is_valid = False, **kwargs):
35 37
         if name is not None and name not in self._validators:
36
-            raise NameError("No validator named '%s'" % name)
38
+            raise LodelFatalError("No validator named '%s'" % name)
37 39
         self.__none_is_valid = none_is_valid
38 40
         self.__name = name
39 41
         self._opt_args = kwargs
@@ -43,8 +45,6 @@ class SettingValidator(object):
43 45
     # @return properly casted value
44 46
     # @throw SettingsValidationError
45 47
     def __call__(self, value):
46
-        if self.__name is None:
47
-            return value
48 48
         if self.__none_is_valid and value is None:
49 49
             return None
50 50
         try:

Loading…
Cancel
Save