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

DateRangeSlider: value and value_throttled turned to DateRange Parameters #3515

Merged
merged 1 commit into from
May 16, 2022

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented May 13, 2022

The value and value_throttled Parameters of the DateRangeSlider widget were of the Parameter type Tuple. This PR turns them into DateRange Parameters. Without that:

  • their Param validation was not as strict as it could have been
  • they could not be properly serialized/deserialized, i.e. Param currently doesn't serialize Parameters that contain datetime values. It will be able to serialize DateRange Parameters after Allow (de)serializing CalendarRange and DateRange Parameters param#625 is merged, and maybe more Parameters in the future.

Before this PR the default value of value was (None, None). This default value is not accepted by the DateRange Parameter that doesn't accept any None in the tuple it holds. The default is now None, which forced me to make some more changes, including no longer having the DateRangeSlider inheriting from _RangeSliderBase since it had logic that diverted from the new logic required to handle this change in default value.

Also, I noticed that before the PR it was possible to instantiate the widget without providing any parameter (e.g. without start or end). This behavior is common to a lot of widgets and is tested in the tests/widgets/test_base.py file. This behavior is still respected after the changed made in this PR. However, I've noticed that not providing the start or end parameters did come with some issues, even if the widget could be instantiated it could never be rendered, Bokeh needs the start/end properties to be set. This should probably be better handled (in another PR!), for now I've just added a warning when start or end aren't set on instantiation.

@philippjfr philippjfr force-pushed the daterangeslider_value_param branch from 1871db2 to 1fdf60e Compare May 15, 2022 18:46
@philippjfr philippjfr force-pushed the daterangeslider_value_param branch from 1fdf60e to c0bf4cc Compare May 15, 2022 18:47
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