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

Add explicit allow_none in Datetime traits. #1964

Merged
merged 5 commits into from
Jan 12, 2023

Conversation

corranwebster
Copy link
Contributor

@corranwebster corranwebster commented Nov 23, 2022

Add allow_none to Datetime bounds in DatetimeEditor and to other uses of Datetime in tests and examples.

This fixes a deprecation warning with recent traits.

Fixes #1963.

Checklist

  • Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst)

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -34,7 +34,7 @@
class DateEditorDemo(HasTraits):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off-topic for this PR, but the DateEditorDemo name is surprising, giving that we're editing a Datetime trait rather than a Date trait.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely either copy/paste error or reflecting the fact that there was no Datetime trait until comparatively recently.

@mdickinson
Copy link
Member

I guess we don't need corresponding changes in the DatetimeEditor editor factory class (traitsui/editors/datetime_editor.py), because it's unlikely that anyone would be deliberately setting a minimum_datetime or maximum_datetime of None there.

@corranwebster
Copy link
Contributor Author

I guess we don't need corresponding changes in the DatetimeEditor editor factory class (traitsui/editors/datetime_editor.py), because it's unlikely that anyone would be deliberately setting a minimum_datetime or maximum_datetime of None there.

Hmmmm... it feels like those probably should as well? It's possible that they were missed when grepping for datetime usages.

@mdickinson
Copy link
Member

Hmmmm... it feels like those probably should as well?

Sure, it certainly wouldn't harm.

@corranwebster corranwebster merged commit 24b271c into main Jan 12, 2023
@corranwebster corranwebster deleted the fix/datetime-none-warning branch January 12, 2023 11:23
corranwebster added a commit that referenced this pull request Jan 12, 2023
Add `allow_none` to `Datetime` bounds in `DatetimeEditor` and to other
uses of `Datetime` in tests and examples.

This fixes a deprecation warning with recent traits.

Fixes #1963.
corranwebster added a commit that referenced this pull request Jan 12, 2023
Add `allow_none` to `Datetime` bounds in `DatetimeEditor` and to other
uses of `Datetime` in tests and examples.

This fixes a deprecation warning with recent traits.

Fixes #1963.
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.

Deprecation warnings regarding allowing None for "Datetime" traits
2 participants