|
@@ -290,6 +290,11 @@ field name" % fieldname)
|
290
|
290
|
err_l[field] = ret
|
291
|
291
|
continue
|
292
|
292
|
field_datahandler = self._target_class.field(field)
|
|
293
|
+ # Casting value given datahandler
|
|
294
|
+ value, error = field_datahandler._check_data_value(value)
|
|
295
|
+ if isinstance(error, Exception):
|
|
296
|
+ err_l[field] = error
|
|
297
|
+ continue
|
293
|
298
|
if ref_field is not None and not field_datahandler.is_reference():
|
294
|
299
|
# inconsistency
|
295
|
300
|
err_l[field] = NameError( "The field '%s' in %s is not \
|
|
@@ -658,17 +663,18 @@ class LeGetQuery(LeFilteredQuery):
|
658
|
663
|
# @throw LeApiQueryError if unknown field given
|
659
|
664
|
def set_field_list(self, field_list):
|
660
|
665
|
err_l = dict()
|
661
|
|
- for fieldname in field_list:
|
662
|
|
- ret = self._check_field(self._target_class, fieldname)
|
663
|
|
- if isinstance(ret, Exception):
|
664
|
|
- msg = "No field named '%s' in %s"
|
665
|
|
- msg %= (fieldname, self._target_class.__name__)
|
666
|
|
- expt = NameError(msg)
|
667
|
|
- err_l[fieldname] = expt
|
668
|
|
- if len(err_l) > 0:
|
669
|
|
- msg = "Error while setting field_list in a get query"
|
670
|
|
- raise LeApiQueryErrors(msg = msg, exceptions = err_l)
|
671
|
|
- self._field_list = list(set(field_list))
|
|
666
|
+ if field_list is not None:
|
|
667
|
+ for fieldname in field_list:
|
|
668
|
+ ret = self._check_field(self._target_class, fieldname)
|
|
669
|
+ if isinstance(ret, Exception):
|
|
670
|
+ msg = "No field named '%s' in %s"
|
|
671
|
+ msg %= (fieldname, self._target_class.__name__)
|
|
672
|
+ expt = NameError(msg)
|
|
673
|
+ err_l[fieldname] = expt
|
|
674
|
+ if len(err_l) > 0:
|
|
675
|
+ msg = "Error while setting field_list in a get query"
|
|
676
|
+ raise LeApiQueryErrors(msg = msg, exceptions = err_l)
|
|
677
|
+ self._field_list = list(set(field_list))
|
672
|
678
|
|
673
|
679
|
##@brief Execute the get query
|
674
|
680
|
def execute(self, datas = None):
|
|
@@ -678,9 +684,10 @@ class LeGetQuery(LeFilteredQuery):
|
678
|
684
|
# @returns a list containing the item(s)
|
679
|
685
|
def _query(self, datas = None):
|
680
|
686
|
# select datas corresponding to query_filter
|
|
687
|
+ fl = list(self._field_list) if self._field_list is not None else None
|
681
|
688
|
l_datas=self._ro_datasource.select(
|
682
|
689
|
target = self._target_class,
|
683
|
|
- field_list = list(self._field_list),
|
|
690
|
+ field_list = fl,
|
684
|
691
|
filters = self._query_filter[0],
|
685
|
692
|
relational_filters = self._query_filter[1],
|
686
|
693
|
order = self._order,
|