make the saving to python a method of the model, called with callbacks

Conflicts:
	IPython/html/static/notebook/js/widgets/widget.js
This commit is contained in:
Jason Grout 2014-01-10 17:31:03 -05:00 committed by Jonathan Frederic
parent 24ec0da125
commit 092e40df32

View File

@ -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());
},
});