|
@@ -37,16 +37,10 @@ class GenericFieldType(object):
|
37
|
37
|
if ftype not in self._allowed_ftype:
|
38
|
38
|
raise AttributeError("Ftype '%s' not known" % ftype)
|
39
|
39
|
|
40
|
|
- if check_data_value is None:
|
41
|
|
- check_data_value = self.dummy_check_data_value
|
42
|
|
- elif not callable(check_data_value):
|
43
|
|
- raise AttributeError("check_data_value argument has to be a function it is a %s" % type(check_data_value))
|
44
|
|
-
|
45
|
40
|
if ftype != self.__class__.ftype:
|
46
|
41
|
raise RuntimeError("The ftype is not the same for the instance and the class. Maybe %s reimplement ftype at class level but shouldn't" % self.name)
|
47
|
42
|
|
48
|
43
|
self.ftype = ftype
|
49
|
|
- self._check_data_value = check_data_value
|
50
|
44
|
self.nullable = bool(nullable)
|
51
|
45
|
self.uniq = bool(uniq)
|
52
|
46
|
|
|
@@ -92,10 +86,10 @@ class GenericFieldType(object):
|
92
|
86
|
def check_data_consistency(self, lec, fname, datas):
|
93
|
87
|
return True
|
94
|
88
|
|
95
|
|
- ## @brief Check if a value is correct
|
|
89
|
+ ## @brief Dummy check, designed to be implemented in child classes
|
96
|
90
|
# @param value * : The value
|
97
|
91
|
# @return (checked_and_casted_value, Exception|None)
|
98
|
|
- def dummy_check_data_value(self, value):
|
|
92
|
+ def _check_data_value(self, value):
|
99
|
93
|
return (value, None)
|
100
|
94
|
|
101
|
95
|
## @brief Given a fieldtype name return the associated python class
|