From dc9a815354062869872fa8bb8eff9eb80fd62aad Mon Sep 17 00:00:00 2001 From: Eduardo Aguad Date: Wed, 25 Oct 2023 09:58:05 -0300 Subject: [PATCH] replace walrus operator --- src/collapsar/Resource.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/collapsar/Resource.py b/src/collapsar/Resource.py index 91b6f93..e8e6a78 100644 --- a/src/collapsar/Resource.py +++ b/src/collapsar/Resource.py @@ -33,7 +33,9 @@ def fields(cls): def paginate(cls, collapsar_request: "CollapsarRequest"): """Paginate the resource.""" search_model = cls.model - if search_string := collapsar_request.input('search'): + search_string = collapsar_request.input('search') + + if search_string: for field in cls.search_fields: search_model = search_model.or_where(field, 'like', f'%{search_string}%')