##// END OF EJS Templates
Fixed testing of new notebook name before saving.
Felix Werner -
Show More
@@ -15,7 +15,7 b' var IPython = (function (IPython) {'
15
15
16 var SaveWidget = function (selector) {
16 var SaveWidget = function (selector) {
17 this.selector = selector;
17 this.selector = selector;
18 this.notebook_name_re = /[^/\\]+/
18 this.notebook_name_blacklist_re = /[\/\\]/
19 this.last_saved_name = '';
19 this.last_saved_name = '';
20 if (this.selector !== undefined) {
20 if (this.selector !== undefined) {
21 this.element = $(selector);
21 this.element = $(selector);
@@ -100,14 +100,14 b' var IPython = (function (IPython) {'
100
100
101 SaveWidget.prototype.test_notebook_name = function () {
101 SaveWidget.prototype.test_notebook_name = function () {
102 var nbname = this.get_notebook_name();
102 var nbname = this.get_notebook_name();
103 if (this.notebook_name_re.test(nbname)) {
103 if (this.notebook_name_blacklist_re.test(nbname) == false) {
104 return true;
104 return true;
105 } else {
105 } else {
106 var bad_name = $('<div/>');
106 var bad_name = $('<div/>');
107 bad_name.html(
107 bad_name.html(
108 "The notebook name you entered (" +
108 "The notebook name you entered (" +
109 nbname +
109 nbname +
110 ") is not valid. Notebook names can contain any characters except / and \\"
110 ") is not valid. Notebook names can contain any characters except / and \\."
111 );
111 );
112 bad_name.dialog({title: 'Invalid name', modal: true});
112 bad_name.dialog({title: 'Invalid name', modal: true});
113 return false;
113 return false;
General Comments 0
You need to be logged in to leave comments. Login now