Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent invalid data to be silently accepted #11

Merged

Conversation

gforcada
Copy link
Contributor

When a user wants sets a Date or Datetime value and misses
one of the fields (day, year, hour or minute) it is silently set to
None without any 'input is not valid' error message being displayed.

Unfortunately it can not be checked on a validator because the input
value has already been converted to a datetime.

This commit works around it making sure an error is raised and only
convert it to None if both day and year are left empty.

@gforcada gforcada force-pushed the invalid-data-is-silently-accepted branch 2 times, most recently from d57af6c to 75096ad Compare October 21, 2015 08:45
When a user wants sets a ``Date`` or ``Datetime`` value and misses
one of the fields (day, year, hour or minute) it is silently set to
None without any 'input is not valid' error message being displayed.

Unfortunately it can not be checked on a validator because the input
value has already been converted to a ``datetime``.

This commit works around it making sure an error is raised and only
convert it to None if both *day* and *year* are left empty.
@gforcada gforcada force-pushed the invalid-data-is-silently-accepted branch from 75096ad to b0a9533 Compare October 21, 2015 08:49
@gforcada gforcada changed the title Prevent invalid data is silently accepted Prevent invalid data to be silently accepted Oct 21, 2015
gforcada added a commit that referenced this pull request Oct 21, 2015
Prevent invalid data to be silently accepted
@gforcada gforcada merged commit 2947f97 into collective:master Oct 21, 2015
@gforcada gforcada deleted the invalid-data-is-silently-accepted branch October 21, 2015 09:04
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.

None yet

2 participants