Skip to content

Filter_in fix#758

Merged
mdipierro merged 2 commits intoweb2py:masterfrom
nursix:filter_in_fix
Jan 18, 2026
Merged

Filter_in fix#758
mdipierro merged 2 commits intoweb2py:masterfrom
nursix:filter_in_fix

Conversation

@nursix
Copy link
Contributor

@nursix nursix commented Jan 12, 2026

Setting the default for a datetime field to datetime.datetime.utcnow (a built-in function) would crash upon insert, due to the mandatory filter_in for that field type.

Either callable defaults are in fact called before filter_in, or filter_in skips them altogether. The difference is that in the former approach, the result of the callable would still be converted with _todatetime, whereas the latter approach simply sends the datetime object for conversion by the representer.

It seems more consistent to also pass the output of a callable through filter_in (note: the output - not the callable, as it were), however, it is a bit confusing why the default _filter_in produces a string for a datetime object if the representer can perfectly handle a datetime object - including the (theoretically dialect-specific) dt_sep?

@nursix nursix changed the title Filter in fix Filter_in fix Jan 12, 2026
@mdipierro mdipierro merged commit 8d82f59 into web2py:master Jan 18, 2026
6 checks passed
@nursix nursix deleted the filter_in_fix branch February 3, 2026 09:59
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