|
@@ -43,20 +43,30 @@ class List(MultipleRef):
|
43
|
43
|
if isinstance(cur_value, str):
|
44
|
44
|
value = cur_value.split(',')
|
45
|
45
|
l_value = [uidtype.cast_type(uid) for uid in value]
|
46
|
|
- #l_value = [int(uid) for uid in value]
|
47
|
|
-
|
48
|
|
- return l_value
|
49
|
46
|
elif isinstance(cur_value, list):
|
50
|
47
|
l_value = list()
|
51
|
|
-
|
52
|
48
|
for value in cur_value:
|
53
|
49
|
if isinstance(value,uidtype):
|
54
|
50
|
l_value.append(value)
|
55
|
51
|
else:
|
56
|
52
|
raise ValueError("The items must be of the same type, string or %s" % (ecomponent.__name__))
|
57
|
|
- return l_value
|
58
|
53
|
else:
|
59
|
|
- return None
|
|
54
|
+ l_value = None
|
|
55
|
+
|
|
56
|
+ if l_value is not None:
|
|
57
|
+ br_class = self.back_reference()[0]
|
|
58
|
+ for br_id in l_value:
|
|
59
|
+ query_filters = list()
|
|
60
|
+ query_filters.append((br_class.uid_fieldname()[0], '=', br_id))
|
|
61
|
+ br_obj = br_class.get(query_filters)
|
|
62
|
+ if len(br_obj) == 0:
|
|
63
|
+ raise ValueError("Not existing instance of class %s in back_reference" % br_class.__name__)
|
|
64
|
+ br_list = br_obj.data(self.back_reference()[1])
|
|
65
|
+ if br_id not in br_list:
|
|
66
|
+ br_list.append(br_id)
|
|
67
|
+ br_obj.set_data(self.back_reference()[1], br_list)
|
|
68
|
+ br_obj.update()
|
|
69
|
+ return l_value
|
60
|
70
|
|
61
|
71
|
##@brief Child class of MultipleRef where references are represented in the form of a python set
|
62
|
72
|
class Set(MultipleRef):
|