diff --git a/CHANGELOG.md b/CHANGELOG.md index 026256670d..7fcf7183bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.26.1 - 2018-08-26 +## Fixed +- Fix bug in `_validate_layout` which would not let a user set `app.layout` to be a function that returns a layout [(fixes #334)](https://github.com/plotly/dash/issues/334). [#336](https://github.com/plotly/dash/pull/336) + ## 0.26.0 - 2018-08-20 ## Added - Added `assets_ignore` init keyword, regex filter for the assets files. [#318](https://github.com/plotly/dash/pull/318) diff --git a/dash/dash.py b/dash/dash.py index 4c78af5825..0a2508b5f9 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -876,10 +876,12 @@ def _validate_layout(self): 'Make sure to set the `layout` attribute of your application ' 'before running the server.') + to_validate = self._layout_value() + layout_id = getattr(self.layout, 'id', None) component_ids = {layout_id} if layout_id else set() - for component in self.layout.traverse(): + for component in to_validate.traverse(): component_id = getattr(component, 'id', None) if component_id and component_id in component_ids: raise exceptions.DuplicateIdError( diff --git a/dash/version.py b/dash/version.py index 826d20e8b6..f96e1c6bed 100644 --- a/dash/version.py +++ b/dash/version.py @@ -1 +1 @@ -__version__ = '0.26.0' +__version__ = '0.26.1' diff --git a/dev-requirements-py37.txt b/dev-requirements-py37.txt index 0196676c3f..0f3238c436 100644 --- a/dev-requirements-py37.txt +++ b/dev-requirements-py37.txt @@ -1,4 +1,4 @@ -dash_core_components>=0.4.0 +dash_core_components>=0.27.2 dash_html_components>=0.12.0rc3 dash-flow-example==0.0.3 dash-dangerously-set-inner-html diff --git a/dev-requirements.txt b/dev-requirements.txt index b9ad002072..240c7cdbaa 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -dash_core_components>=0.27.1 +dash_core_components>=0.27.2 dash_html_components>=0.12.0rc3 dash_flow_example==0.0.3 dash-dangerously-set-inner-html diff --git a/tests/test_integration.py b/tests/test_integration.py index 011b343504..1c42bce431 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -521,3 +521,14 @@ def test_external_files_init(self): # ensure ramda was loaded before the assets so they can use it. lo_test = self.driver.find_element_by_id('ramda-test') self.assertEqual('Hello World', lo_test.text) + + def test_func_layout_accepted(self): + + app = dash.Dash() + + def create_layout(): + return html.Div('Hello World') + app.layout = create_layout + + self.startServer(app) + time.sleep(0.5)