diff --git a/tailbone/grids/filters.py b/tailbone/grids/filters.py index 3f23196d..b80f6050 100644 --- a/tailbone/grids/filters.py +++ b/tailbone/grids/filters.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2020 Lance Edgar # # This file is part of Rattail. # @@ -859,8 +859,13 @@ class AlchemyGPCFilter(AlchemyGridFilter): """ Filter data with an equal ('=') query. """ - if value is None or value == '': + if value is None: return query + + value = value.strip() + if not value: + return query + try: return query.filter(self.column.in_(( GPC(value), @@ -870,9 +875,13 @@ class AlchemyGPCFilter(AlchemyGridFilter): def filter_not_equal(self, query, value): """ - Filter data with a not eqaul ('!=') query. + Filter data with a not equal ('!=') query. """ - if value is None or value == '': + if value is None: + return query + + value = value.strip() + if not value: return query # When saying something is 'not equal' to something else, we must also