Skip to content

Commit

Permalink
[qa] fix tests value has no len
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBldy committed Sep 6, 2024
1 parent 725650f commit d197a81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion zou/app/blueprints/crud/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def build_filters(self, options):
) and isinstance(
field_key.property, orm.properties.RelationshipProperty
)
value_is_list = len(value) > 0 and value[0] == "["
value_is_list = (
hasattr(value, "__len__")
and len(value) > 0
and value[0] == "["
)

if key == "name" and field_key is not None:
name_filter.append(value)
Expand Down
6 changes: 5 additions & 1 deletion zou/app/utils/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def apply_criterions_to_db_query(model, db_query, criterions):
) and isinstance(
field_key.property, orm.properties.RelationshipProperty
)
value_is_list = len(value) > 0 and value[0] == "["
value_is_list = (
hasattr(value, "__len__")
and len(value) > 0
and value[0] == "["
)

if key == "name" and field_key is not None:
name_filter.append(value)
Expand Down

0 comments on commit d197a81

Please sign in to comment.