Tweak how a grid filter factory is determined

Don't inspect anything if a factory is provided by caller.
This commit is contained in:
Lance Edgar 2016-09-19 16:34:12 -05:00
parent 65d1c24230
commit 1c45472fe5

View file

@ -93,6 +93,8 @@ class AlchemyGrid(Grid):
""" """
Make a filter suitable for use with the given column. Make a filter suitable for use with the given column.
""" """
factory = kwargs.pop('factory', None)
if not factory:
factory = filters.AlchemyGridFilter factory = filters.AlchemyGridFilter
if isinstance(column.type, sa.String): if isinstance(column.type, sa.String):
factory = filters.AlchemyStringFilter factory = filters.AlchemyStringFilter
@ -108,7 +110,6 @@ class AlchemyGrid(Grid):
factory = filters.AlchemyDateTimeFilter factory = filters.AlchemyDateTimeFilter
elif isinstance(column.type, GPCType): elif isinstance(column.type, GPCType):
factory = filters.AlchemyGPCFilter factory = filters.AlchemyGPCFilter
factory = kwargs.pop('factory', factory)
return factory(key, column=column, config=self.request.rattail_config, **kwargs) return factory(key, column=column, config=self.request.rattail_config, **kwargs)
def iter_filters(self): def iter_filters(self):