From bab9d25d8fc27ef025dea04bfe113524a76b28f7 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Tue, 5 May 2020 17:26:18 -0400 Subject: [PATCH] Don't disable validation when constructing FigureWidget's template. We need to run through all of this logic to generate the messages to send to the front-end. --- packages/python/plotly/plotly/basedatatypes.py | 4 +++- packages/python/plotly/plotly/basewidget.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/python/plotly/plotly/basedatatypes.py b/packages/python/plotly/plotly/basedatatypes.py index ee9ce457451..87da535702a 100644 --- a/packages/python/plotly/plotly/basedatatypes.py +++ b/packages/python/plotly/plotly/basedatatypes.py @@ -37,6 +37,7 @@ class BaseFigure(object): } _set_trace_uid = False + _allow_disable_validation = True # Constructor # ----------- @@ -1947,7 +1948,8 @@ def _initialize_layout_template(self): if self._layout_obj._props.get("template", None) is None: if pio.templates.default is not None: # Assume default template is already validated - self._layout_obj._validate = False + if self._allow_disable_validation: + self._layout_obj._validate = False try: template_dict = pio.templates[pio.templates.default] self._layout_obj.template = template_dict diff --git a/packages/python/plotly/plotly/basewidget.py b/packages/python/plotly/plotly/basewidget.py index 02e7ed2f9f5..e0a94956d77 100644 --- a/packages/python/plotly/plotly/basewidget.py +++ b/packages/python/plotly/plotly/basewidget.py @@ -101,6 +101,7 @@ class BaseFigureWidget(BaseFigure, widgets.DOMWidget): _last_trace_edit_id = Integer(0).tag(sync=True) _set_trace_uid = True + _allow_disable_validation = False # Constructor # -----------