diff --git a/paramecio/cromosoma/webmodel.py b/paramecio/cromosoma/webmodel.py index 3bda97e..3799826 100644 --- a/paramecio/cromosoma/webmodel.py +++ b/paramecio/cromosoma/webmodel.py @@ -854,7 +854,14 @@ class WebModel: except: in_list[x]=str(0) return '('+', '.join(in_list)+')' - + + def check_in_list_str(self, field, in_list): + + for x in range(0, len(in_list)): + in_list[x]=self.fields[field].check(in_list[x]) + + return '("'+'", "'.join(in_list)+'")' + def set_order(self, order:dict) -> object: arr_order=[] diff --git a/tests/webmodeltest.py b/tests/webmodeltest.py index 910a183..487a4b4 100644 --- a/tests/webmodeltest.py +++ b/tests/webmodeltest.py @@ -265,6 +265,19 @@ class TestWebModelMethods(unittest.TestCase): connection.close() pass + + def test_check_filter_list_str(self): + + print('Check string list filtering') + + connection=WebModel.connection() + model=ExampleModel(connection) + + str_filter=model.check_in_list_str('title', ['joan', 'piter', 'luiz"']) + + self.assertEqual(str_filter, '("joan", "piter", "luiz"")') + + connection.close() if __name__ == '__main__': unittest.main()