|
@@ -7,9 +7,9 @@ from lodel.context import LodelContext
|
7
|
7
|
|
8
|
8
|
LodelContext.expose_modules(globals(), {
|
9
|
9
|
'lodel.leapi.datahandlers.datas_base': ['Boolean', 'Integer', 'Varchar',
|
10
|
|
- 'DateTime', 'Text', 'File'],
|
|
10
|
+ 'DateTime', 'Text', 'File'],
|
11
|
11
|
'lodel.exceptions': ['LodelException', 'LodelExceptions',
|
12
|
|
- 'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
|
|
12
|
+ 'LodelFatalError', 'DataNoneValid', 'FieldValidationError']})
|
13
|
13
|
|
14
|
14
|
|
15
|
15
|
##@brief Data field designed to handle formated strings
|
|
@@ -26,7 +26,7 @@ build its content'
|
26
|
26
|
def __init__(self, format_string, field_list, **kwargs):
|
27
|
27
|
self._field_list = field_list
|
28
|
28
|
self._format_string = format_string
|
29
|
|
- super().__init__(internal='automatic',**kwargs)
|
|
29
|
+ super().__init__(internal='automatic', **kwargs)
|
30
|
30
|
|
31
|
31
|
def _construct_data(self, emcomponent, fname, datas, cur_value):
|
32
|
32
|
ret = self._format_string % tuple(
|
|
@@ -49,7 +49,7 @@ max_length and regex'
|
49
|
49
|
# @param **kwargs
|
50
|
50
|
def __init__(self, regex='', max_length=10, **kwargs):
|
51
|
51
|
self.regex = regex
|
52
|
|
- self.compiled_re = re.compile(regex)#trigger an error if invalid regex
|
|
52
|
+ self.compiled_re = re.compile(regex) # trigger an error if invalid regex
|
53
|
53
|
super(self.__class__, self).__init__(max_length=max_length, **kwargs)
|
54
|
54
|
|
55
|
55
|
##@brief Check and cast value in appropriate type
|
|
@@ -106,7 +106,8 @@ be internal")
|
106
|
106
|
if not inspect.isclass(emcomponent):
|
107
|
107
|
cls = emcomponent.__class__
|
108
|
108
|
return cls.__name__
|
109
|
|
-
|
|
109
|
+
|
|
110
|
+
|
110
|
111
|
##@brief Data field designed to handle concatenated fields
|
111
|
112
|
class Concat(FormatString):
|
112
|
113
|
help = 'Automatic strings concatenation'
|
|
@@ -116,11 +117,11 @@ class Concat(FormatString):
|
116
|
117
|
# @param field_list list : List of field to use
|
117
|
118
|
# @param separator str
|
118
|
119
|
# @param **kwargs
|
119
|
|
- def __init__(self, field_list, separator = ' ', **kwargs):
|
|
120
|
+ def __init__(self, field_list, separator=' ', **kwargs):
|
120
|
121
|
format_string = separator.join(['%s' for _ in field_list])
|
121
|
|
- super().__init__(
|
122
|
|
- format_string = format_string, field_list = field_list, **kwargs)
|
123
|
|
-
|
|
122
|
+ super().__init__(format_string=format_string,
|
|
123
|
+ field_list=field_list,
|
|
124
|
+ **kwargs)
|
124
|
125
|
|
125
|
126
|
|
126
|
127
|
class Password(Varchar):
|
|
@@ -129,7 +130,6 @@ class Password(Varchar):
|
129
|
130
|
pass
|
130
|
131
|
|
131
|
132
|
|
132
|
|
-
|
133
|
133
|
class VarcharList(Varchar):
|
134
|
134
|
help = 'DataHandler designed to make a list out of a string.'
|
135
|
135
|
base_type = 'varchar'
|
|
@@ -140,7 +140,6 @@ class VarcharList(Varchar):
|
140
|
140
|
self.delimiter = str(delimiter)
|
141
|
141
|
super().__init__(**kwargs)
|
142
|
142
|
|
143
|
|
-
|
144
|
143
|
def construct_data(self, emcomponent, fname, datas, cur_value):
|
145
|
144
|
result = cur_value.split(self.delimiter)
|
146
|
145
|
return result
|