pallets-eco/wtforms-sqlalchemy

QuerySelectField query parameter ignored when the query returns no result.

TrilceAC opened this issue · 0 comments

I have reported an issue on wtforms-alchemy which also occures in wtforms-sqlalchemy. When using QuerySelectField.query in a view with a query that ends returning no result, it is silently ignored in favor of query_factory.

When deciding between either query or query_factory the logic ignores the fact that empty lists are evaluated to False, and therefore query_factory is used even when there was a query with no results.

I have prepared a fix and it pull request.