Skip to content

Commit

Permalink
jupyter#751 handling widget metadata without model_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Mitusinski committed Mar 15, 2018
1 parent b5e9997 commit a301aa4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nbconvert/preprocessors/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def start_new_kernel(startup_timeout=60, kernel_name='python', **kwargs):
'application/vnd.jupyter.widget-state+json': {
'state': {
model_id: _serialize_widget_state(state)
for model_id, state in self.widget_state.items()
for model_id, state in self.widget_state.items() if '_model_name' in state
},
'version_major': 2,
'version_minor': 0,
Expand Down Expand Up @@ -486,8 +486,8 @@ def _serialize_widget_state(state):
TODO: Does not currently split binary buffers or remove default values.
"""
return {
'model_name': state['_model_name'],
'model_module': state['_model_module'],
'model_name': state.get('_model_name'),
'model_module': state.get('_model_module'),
'model_module_version': state.get('_model_module_version'),
'state': state,
}
Expand Down

0 comments on commit a301aa4

Please sign in to comment.