Skip to content

Treat empty string as None in _todate/_totime/_todatetime filter_in#760

Open
nursix wants to merge 1 commit intoweb2py:masterfrom
nursix:filter_in_fix
Open

Treat empty string as None in _todate/_totime/_todatetime filter_in#760
nursix wants to merge 1 commit intoweb2py:masterfrom
nursix:filter_in_fix

Conversation

@nursix
Copy link
Contributor

@nursix nursix commented Feb 3, 2026

Currently, the standard filter_in methods for date/time/datetime fields would crash for empty strings (AssertionError).

This fix catches empty strings, and treats them as None-equivalent (i.e. NULL).

One could consider to pass an empty string as-is, but this seems invalid as parsers expect either NULL or a valid date/time string for these field types - and even if parsers could handle empty strings for date/time, surely they would return None (what else?), which makes them equivalent to NULL on a round-trip. Hence, returning None for both None and "" seems correct for these particular filter_in methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant