Skip to content

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

Merged
mdipierro merged 1 commit intoweb2py:masterfrom
nursix:filter_in_fix
Mar 14, 2026
Merged

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

Conversation

@nursix
Copy link
Copy Markdown
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.

@mdipierro mdipierro merged commit 0942ae3 into web2py:master Mar 14, 2026
6 checks passed
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.

2 participants