Procházet zdrojové kódy

Adding of an attribute cast_type in UniqID datahandler, for a right insertion of uids in database

prieto před 8 roky
rodič
revize
1cb07dc6bf

+ 2
- 1
lodel/leapi/datahandlers/datas.py Zobrazit soubor

@@ -9,7 +9,7 @@ class FormatString(Varchar):
9 9
     help = 'Automatic string field, designed to use the str % operator to \
10 10
 build its content'
11 11
     base_type = 'char'
12
-
12
+    
13 13
     ##@brief Build its content with a field list and a format string
14 14
     # @param format_string str
15 15
     # @param max_length int : the maximum length of the handled value
@@ -65,6 +65,7 @@ class UniqID(Integer):
65 65
 
66 66
     help = 'Fieldtype designed to handle editorial model UID'
67 67
     base_type = 'int'
68
+    cast_type = int
68 69
 
69 70
     ##@brief A uid field
70 71
     # @param **kwargs

+ 2
- 2
lodel/leapi/datahandlers/references.py Zobrazit soubor

@@ -42,8 +42,8 @@ class List(MultipleRef):
42 42
 
43 43
         if isinstance(cur_value, str):
44 44
             value = cur_value.split(',')
45
-            l_value = [int(uid) for uid in value] ## à remplacer par uidtype
46
-            logger.debug(l_value)
45
+            l_value = [uidtype.cast_type(uid) for uid in value] ## à remplacer par uidtype
46
+
47 47
             return l_value
48 48
         elif isinstance(cur_value, list):
49 49
             type_list = str if isinstance(cur_value[0], str) else uidtype

Loading…
Zrušit
Uložit