From df4f73318e156ee81917bed550233247ad113eed 2014-01-17 15:10:17 From: Jason Grout Date: 2014-01-17 15:10:17 Subject: [PATCH] make the saving to python a method of the model, called with callbacks Conflicts: IPython/html/static/notebook/js/widgets/widget.js --- diff --git a/IPython/html/static/notebook/js/widgets/widget.js b/IPython/html/static/notebook/js/widgets/widget.js index 2b13062..3419778 100644 --- a/IPython/html/static/notebook/js/widgets/widget.js +++ b/IPython/html/static/notebook/js/widgets/widget.js @@ -171,6 +171,13 @@ function(widget_manager, underscore, backbone){ return model_json; }, + push: function(callbacks) { + // Push this model's state to the back-end + // + // This invokes a Backbone.Sync. + this.save(this.changedAttributes(), {patch: true, callbacks: callbacks}); + }, + _pack_models: function(value) { // Replace models with model ids recursively. if (value instanceof Backbone.Model) { @@ -288,8 +295,7 @@ function(widget_manager, underscore, backbone){ }, touch: function () { - // Associate recent model changes with this notebook. - this.model.save(this.model.changedAttributes(), {patch: true, callbacks: this.callbacks()}); + this.model.push(this.callbacks()); }, });