Make ContentManager stateless

Don't store notebook_path in ContentManager, because this sort of state (in addition to notebook_name) can change, and keeping track of this logic doesn't seem to be a part of the file management system.  Instead, this logic can be left to the Notebook instance (and possible other places that manage it).  This makes refactoring easier, and avoids having to replicate this logic in every implementation of ContentManager.
KesterTong 12 years ago committed by Thomas Kluyver
parent 99f2647edd
commit 5717a3eb10

@ -16,15 +16,21 @@ define([
// Parameters:
// options: dictionary
// Dictionary of keyword arguments.
// notebook_path: string
// events: $(Events) instance
// base_url: string
this.version = 0.1;
this.notebook_path = options.notebook_path;
this.events = options.events;
this.base_url = options.base_url;
};
ContentManager.prototype.new_notebook = function() {
var path = this.notebook_path;
/**
* Creates a new notebook file at the specified path, and
* opens that notebook in a new window.
*
* @method scroll_to_cell
* @param {String} path The path to create the new notebook at
*/
ContentManager.prototype.new_notebook = function(path) {
var base_url = this.base_url;
var settings = {
processData : false,

Loading…
Cancel
Save