##// END OF EJS Templates
s/base_project_url/base_url/...
MinRK -
Show More
@@ -32,13 +32,13 b' class LoginHandler(IPythonHandler):'
32
32
33 def _render(self, message=None):
33 def _render(self, message=None):
34 self.write(self.render_template('login.html',
34 self.write(self.render_template('login.html',
35 next=url_escape(self.get_argument('next', default=self.base_project_url)),
35 next=url_escape(self.get_argument('next', default=self.base_url)),
36 message=message,
36 message=message,
37 ))
37 ))
38
38
39 def get(self):
39 def get(self):
40 if self.current_user:
40 if self.current_user:
41 self.redirect(self.get_argument('next', default=self.base_project_url))
41 self.redirect(self.get_argument('next', default=self.base_url))
42 else:
42 else:
43 self._render()
43 self._render()
44
44
@@ -51,7 +51,7 b' class LoginHandler(IPythonHandler):'
51 self._render(message={'error': 'Invalid password'})
51 self._render(message={'error': 'Invalid password'})
52 return
52 return
53
53
54 self.redirect(self.get_argument('next', default=self.base_project_url))
54 self.redirect(self.get_argument('next', default=self.base_url))
55
55
56
56
57 #-----------------------------------------------------------------------------
57 #-----------------------------------------------------------------------------
@@ -133,8 +133,8 b' class IPythonHandler(AuthenticatedHandler):'
133 return self.settings.get('mathjax_url', '')
133 return self.settings.get('mathjax_url', '')
134
134
135 @property
135 @property
136 def base_project_url(self):
136 def base_url(self):
137 return self.settings.get('base_project_url', '/')
137 return self.settings.get('base_url', '/')
138
138
139 @property
139 @property
140 def base_kernel_url(self):
140 def base_kernel_url(self):
@@ -180,7 +180,7 b' class IPythonHandler(AuthenticatedHandler):'
180 @property
180 @property
181 def template_namespace(self):
181 def template_namespace(self):
182 return dict(
182 return dict(
183 base_project_url=self.base_project_url,
183 base_url=self.base_url,
184 base_kernel_url=self.base_kernel_url,
184 base_kernel_url=self.base_kernel_url,
185 logged_in=self.logged_in,
185 logged_in=self.logged_in,
186 login_available=self.login_available,
186 login_available=self.login_available,
@@ -58,7 +58,7 b' class NotebookRedirectHandler(IPythonHandler):'
58 nbm = self.notebook_manager
58 nbm = self.notebook_manager
59 if nbm.path_exists(path):
59 if nbm.path_exists(path):
60 # it's a *directory*, redirect to /tree
60 # it's a *directory*, redirect to /tree
61 url = url_path_join(self.base_project_url, 'tree', path)
61 url = url_path_join(self.base_url, 'tree', path)
62 else:
62 else:
63 # otherwise, redirect to /files
63 # otherwise, redirect to /files
64 if '/files/' in path:
64 if '/files/' in path:
@@ -73,7 +73,7 b' class NotebookRedirectHandler(IPythonHandler):'
73 if not os.path.exists(files_path):
73 if not os.path.exists(files_path):
74 path = path.replace('/files/', '/', 1)
74 path = path.replace('/files/', '/', 1)
75
75
76 url = url_path_join(self.base_project_url, 'files', path)
76 url = url_path_join(self.base_url, 'files', path)
77 url = url_escape(url)
77 url = url_escape(url)
78 self.log.debug("Redirecting %s to %s", self.request.path, url)
78 self.log.debug("Redirecting %s to %s", self.request.path, url)
79 self.redirect(url)
79 self.redirect(url)
@@ -133,42 +133,42 b' def load_handlers(name):'
133 class NotebookWebApplication(web.Application):
133 class NotebookWebApplication(web.Application):
134
134
135 def __init__(self, ipython_app, kernel_manager, notebook_manager,
135 def __init__(self, ipython_app, kernel_manager, notebook_manager,
136 cluster_manager, session_manager, log, base_project_url,
136 cluster_manager, session_manager, log, base_url,
137 settings_overrides):
137 settings_overrides):
138
138
139 settings = self.init_settings(
139 settings = self.init_settings(
140 ipython_app, kernel_manager, notebook_manager, cluster_manager,
140 ipython_app, kernel_manager, notebook_manager, cluster_manager,
141 session_manager, log, base_project_url, settings_overrides)
141 session_manager, log, base_url, settings_overrides)
142 handlers = self.init_handlers(settings)
142 handlers = self.init_handlers(settings)
143
143
144 super(NotebookWebApplication, self).__init__(handlers, **settings)
144 super(NotebookWebApplication, self).__init__(handlers, **settings)
145
145
146 def init_settings(self, ipython_app, kernel_manager, notebook_manager,
146 def init_settings(self, ipython_app, kernel_manager, notebook_manager,
147 cluster_manager, session_manager, log, base_project_url,
147 cluster_manager, session_manager, log, base_url,
148 settings_overrides):
148 settings_overrides):
149 # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
149 # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
150 # base_project_url will always be unicode, which will in turn
150 # base_url will always be unicode, which will in turn
151 # make the patterns unicode, and ultimately result in unicode
151 # make the patterns unicode, and ultimately result in unicode
152 # keys in kwargs to handler._execute(**kwargs) in tornado.
152 # keys in kwargs to handler._execute(**kwargs) in tornado.
153 # This enforces that base_project_url be ascii in that situation.
153 # This enforces that base_url be ascii in that situation.
154 #
154 #
155 # Note that the URLs these patterns check against are escaped,
155 # Note that the URLs these patterns check against are escaped,
156 # and thus guaranteed to be ASCII: 'hΓ©llo' is really 'h%C3%A9llo'.
156 # and thus guaranteed to be ASCII: 'hΓ©llo' is really 'h%C3%A9llo'.
157 base_project_url = py3compat.unicode_to_str(base_project_url, 'ascii')
157 base_url = py3compat.unicode_to_str(base_url, 'ascii')
158 template_path = settings_overrides.get("template_path", os.path.join(os.path.dirname(__file__), "templates"))
158 template_path = settings_overrides.get("template_path", os.path.join(os.path.dirname(__file__), "templates"))
159 settings = dict(
159 settings = dict(
160 # basics
160 # basics
161 log_function=log_request,
161 log_function=log_request,
162 base_project_url=base_project_url,
162 base_url=base_url,
163 base_kernel_url=ipython_app.base_kernel_url,
163 base_kernel_url=ipython_app.base_kernel_url,
164 template_path=template_path,
164 template_path=template_path,
165 static_path=ipython_app.static_file_path,
165 static_path=ipython_app.static_file_path,
166 static_handler_class = FileFindHandler,
166 static_handler_class = FileFindHandler,
167 static_url_prefix = url_path_join(base_project_url,'/static/'),
167 static_url_prefix = url_path_join(base_url,'/static/'),
168
168
169 # authentication
169 # authentication
170 cookie_secret=ipython_app.cookie_secret,
170 cookie_secret=ipython_app.cookie_secret,
171 login_url=url_path_join(base_project_url,'/login'),
171 login_url=url_path_join(base_url,'/login'),
172 password=ipython_app.password,
172 password=ipython_app.password,
173
173
174 # managers
174 # managers
@@ -206,10 +206,10 b' class NotebookWebApplication(web.Application):'
206 (r"/files/(.*)", AuthenticatedFileHandler, {'path' : settings['notebook_manager'].notebook_dir}),
206 (r"/files/(.*)", AuthenticatedFileHandler, {'path' : settings['notebook_manager'].notebook_dir}),
207 (r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}),
207 (r"/nbextensions/(.*)", FileFindHandler, {'path' : settings['nbextensions_path']}),
208 ])
208 ])
209 # prepend base_project_url onto the patterns that we match
209 # prepend base_url onto the patterns that we match
210 new_handlers = []
210 new_handlers = []
211 for handler in handlers:
211 for handler in handlers:
212 pattern = url_path_join(settings['base_project_url'], handler[0])
212 pattern = url_path_join(settings['base_url'], handler[0])
213 new_handler = tuple([pattern] + list(handler[1:]))
213 new_handler = tuple([pattern] + list(handler[1:]))
214 new_handlers.append(new_handler)
214 new_handlers.append(new_handler)
215 # add 404 on the end, which will catch everything that falls through
215 # add 404 on the end, which will catch everything that falls through
@@ -414,17 +414,22 b' class NotebookApp(BaseIPythonApplication):'
414 if not new:
414 if not new:
415 self.mathjax_url = u''
415 self.mathjax_url = u''
416
416
417 base_project_url = Unicode('/', config=True,
417 base_url = Unicode('/', config=True,
418 help='''The base URL for the notebook server.
418 help='''The base URL for the notebook server.
419
419
420 Leading and trailing slashes can be omitted,
420 Leading and trailing slashes can be omitted,
421 and will automatically be added.
421 and will automatically be added.
422 ''')
422 ''')
423 def _base_project_url_changed(self, name, old, new):
423 def _base_url_changed(self, name, old, new):
424 if not new.startswith('/'):
424 if not new.startswith('/'):
425 self.base_project_url = '/'+new
425 self.base_url = '/'+new
426 elif not new.endswith('/'):
426 elif not new.endswith('/'):
427 self.base_project_url = new+'/'
427 self.base_url = new+'/'
428
429 base_project_url = Unicode('/', config=True, help="""DEPRECATED use base_url""")
430 def _base_project_url_changed(self, name, old, new):
431 self.log.warn("base_project_url is deprecated, use base_url")
432 self.base_url = new
428
433
429 base_kernel_url = Unicode('/', config=True,
434 base_kernel_url = Unicode('/', config=True,
430 help='''The base URL for the kernel server
435 help='''The base URL for the kernel server
@@ -473,12 +478,12 b' class NotebookApp(BaseIPythonApplication):'
473 if not self.enable_mathjax:
478 if not self.enable_mathjax:
474 return u''
479 return u''
475 static_url_prefix = self.webapp_settings.get("static_url_prefix",
480 static_url_prefix = self.webapp_settings.get("static_url_prefix",
476 url_path_join(self.base_project_url, "static")
481 url_path_join(self.base_url, "static")
477 )
482 )
478
483
479 # try local mathjax, either in nbextensions/mathjax or static/mathjax
484 # try local mathjax, either in nbextensions/mathjax or static/mathjax
480 for (url_prefix, search_path) in [
485 for (url_prefix, search_path) in [
481 (url_path_join(self.base_project_url, "nbextensions"), self.nbextensions_path),
486 (url_path_join(self.base_url, "nbextensions"), self.nbextensions_path),
482 (static_url_prefix, self.static_file_path),
487 (static_url_prefix, self.static_file_path),
483 ]:
488 ]:
484 self.log.debug("searching for local mathjax in %s", search_path)
489 self.log.debug("searching for local mathjax in %s", search_path)
@@ -586,7 +591,7 b' class NotebookApp(BaseIPythonApplication):'
586 self.web_app = NotebookWebApplication(
591 self.web_app = NotebookWebApplication(
587 self, self.kernel_manager, self.notebook_manager,
592 self, self.kernel_manager, self.notebook_manager,
588 self.cluster_manager, self.session_manager,
593 self.cluster_manager, self.session_manager,
589 self.log, self.base_project_url, self.webapp_settings
594 self.log, self.base_url, self.webapp_settings
590 )
595 )
591 if self.certfile:
596 if self.certfile:
592 ssl_options = dict(certfile=self.certfile)
597 ssl_options = dict(certfile=self.certfile)
@@ -639,7 +644,7 b' class NotebookApp(BaseIPythonApplication):'
639
644
640 def _url(self, ip):
645 def _url(self, ip):
641 proto = 'https' if self.certfile else 'http'
646 proto = 'https' if self.certfile else 'http'
642 return "%s://%s:%i%s" % (proto, ip, self.port, self.base_project_url)
647 return "%s://%s:%i%s" % (proto, ip, self.port, self.base_url)
643
648
644 def init_signal(self):
649 def init_signal(self):
645 if not sys.platform.startswith('win'):
650 if not sys.platform.startswith('win'):
@@ -745,7 +750,7 b' class NotebookApp(BaseIPythonApplication):'
745 'hostname': self.ip if self.ip else 'localhost',
750 'hostname': self.ip if self.ip else 'localhost',
746 'port': self.port,
751 'port': self.port,
747 'secure': bool(self.certfile),
752 'secure': bool(self.certfile),
748 'base_project_url': self.base_project_url,
753 'base_url': self.base_url,
749 'notebook_dir': os.path.abspath(self.notebook_manager.notebook_dir),
754 'notebook_dir': os.path.abspath(self.notebook_manager.notebook_dir),
750 }
755 }
751
756
@@ -47,7 +47,7 b' class NotebookHandler(IPythonHandler):'
47 The URL path of the notebook.
47 The URL path of the notebook.
48 """
48 """
49 return url_escape(url_path_join(
49 return url_escape(url_path_join(
50 self.base_project_url, 'api', 'notebooks', path, name
50 self.base_url, 'api', 'notebooks', path, name
51 ))
51 ))
52
52
53 def _finish_model(self, model, location=True):
53 def _finish_model(self, model, location=True):
@@ -242,7 +242,7 b' class NotebookCheckpointsHandler(IPythonHandler):'
242 nbm = self.notebook_manager
242 nbm = self.notebook_manager
243 checkpoint = nbm.create_checkpoint(name, path)
243 checkpoint = nbm.create_checkpoint(name, path)
244 data = json.dumps(checkpoint, default=date_default)
244 data = json.dumps(checkpoint, default=date_default)
245 location = url_path_join(self.base_project_url, 'api/notebooks',
245 location = url_path_join(self.base_url, 'api/notebooks',
246 path, name, 'checkpoints', checkpoint['id'])
246 path, name, 'checkpoints', checkpoint['id'])
247 self.set_header('Location', url_escape(location))
247 self.set_header('Location', url_escape(location))
248 self.set_status(201)
248 self.set_status(201)
@@ -14,7 +14,7 b' var IPython = (function (IPython) {'
14
14
15 var LoginWidget = function (selector, options) {
15 var LoginWidget = function (selector, options) {
16 options = options || {};
16 options = options || {};
17 this.base_project_url = options.base_project_url || IPython.utils.get_data("baseProjectUrl");
17 this.base_url = options.base_url || IPython.utils.get_data("baseUrl");
18 this.selector = selector;
18 this.selector = selector;
19 if (this.selector !== undefined) {
19 if (this.selector !== undefined) {
20 this.element = $(selector);
20 this.element = $(selector);
@@ -32,13 +32,13 b' var IPython = (function (IPython) {'
32 var that = this;
32 var that = this;
33 this.element.find("button#logout").click(function () {
33 this.element.find("button#logout").click(function () {
34 window.location = IPythin.utils.url_join_encode(
34 window.location = IPythin.utils.url_join_encode(
35 that.base_project_url,
35 that.base_url,
36 "logout"
36 "logout"
37 );
37 );
38 });
38 });
39 this.element.find("button#login").click(function () {
39 this.element.find("button#login").click(function () {
40 window.location = IPythin.utils.url_join_encode(
40 window.location = IPythin.utils.url_join_encode(
41 that.base_project_url,
41 that.base_url,
42 "login"
42 "login"
43 );
43 );
44 });
44 });
@@ -47,7 +47,7 b' function (marked) {'
47 $('div#notebook_panel').addClass('border-box-sizing');
47 $('div#notebook_panel').addClass('border-box-sizing');
48
48
49 var opts = {
49 var opts = {
50 base_project_url : IPython.utils.get_data("baseProjectUrl"),
50 base_url : IPython.utils.get_data("baseUrl"),
51 base_kernel_url : IPython.utils.get_data("baseKernelUrl"),
51 base_kernel_url : IPython.utils.get_data("baseKernelUrl"),
52 notebook_path : IPython.utils.get_data("notebookPath"),
52 notebook_path : IPython.utils.get_data("notebookPath"),
53 notebook_name : IPython.utils.get_data('notebookName')
53 notebook_name : IPython.utils.get_data('notebookName')
@@ -30,14 +30,14 b' var IPython = (function (IPython) {'
30 *
30 *
31 * @param selector {string} selector for the menubar element in DOM
31 * @param selector {string} selector for the menubar element in DOM
32 * @param {object} [options]
32 * @param {object} [options]
33 * @param [options.base_project_url] {String} String to use for the
33 * @param [options.base_url] {String} String to use for the
34 * base project url. Default is to inspect
34 * base project url. Default is to inspect
35 * $('body').data('baseProjectUrl');
35 * $('body').data('baseUrl');
36 * does not support change for now is set through this option
36 * does not support change for now is set through this option
37 */
37 */
38 var MenuBar = function (selector, options) {
38 var MenuBar = function (selector, options) {
39 options = options || {};
39 options = options || {};
40 this.base_project_url = options.base_project_url || IPython.utils.get_data("baseProjectUrl");
40 this.base_url = options.base_url || IPython.utils.get_data("baseUrl");
41 this.selector = selector;
41 this.selector = selector;
42 if (this.selector !== undefined) {
42 if (this.selector !== undefined) {
43 this.element = $(selector);
43 this.element = $(selector);
@@ -64,7 +64,7 b' var IPython = (function (IPython) {'
64 IPython.notebook.save_notebook({async : false});
64 IPython.notebook.save_notebook({async : false});
65 }
65 }
66 var url = utils.url_join_encode(
66 var url = utils.url_join_encode(
67 this.base_project_url,
67 this.base_url,
68 'nbconvert',
68 'nbconvert',
69 format,
69 format,
70 this.notebook_path,
70 this.notebook_path,
@@ -24,7 +24,7 b' var IPython = (function (IPython) {'
24 */
24 */
25 var Notebook = function (selector, options) {
25 var Notebook = function (selector, options) {
26 this.options = options = options || {};
26 this.options = options = options || {};
27 this.base_project_url = options.base_project_url;
27 this.base_url = options.base_url;
28 this.notebook_path = options.notebook_path;
28 this.notebook_path = options.notebook_path;
29 this.notebook_name = options.notebook_name;
29 this.notebook_name = options.notebook_name;
30 this.element = $(selector);
30 this.element = $(selector);
@@ -1683,7 +1683,7 b' var IPython = (function (IPython) {'
1683 }
1683 }
1684 $([IPython.events]).trigger('notebook_saving.Notebook');
1684 $([IPython.events]).trigger('notebook_saving.Notebook');
1685 var url = utils.url_join_encode(
1685 var url = utils.url_join_encode(
1686 this.base_project_url,
1686 this.base_url,
1687 'api/notebooks',
1687 'api/notebooks',
1688 this.notebook_path,
1688 this.notebook_path,
1689 this.notebook_name
1689 this.notebook_name
@@ -1744,7 +1744,7 b' var IPython = (function (IPython) {'
1744
1744
1745 Notebook.prototype.new_notebook = function(){
1745 Notebook.prototype.new_notebook = function(){
1746 var path = this.notebook_path;
1746 var path = this.notebook_path;
1747 var base_project_url = this.base_project_url;
1747 var base_url = this.base_url;
1748 var settings = {
1748 var settings = {
1749 processData : false,
1749 processData : false,
1750 cache : false,
1750 cache : false,
@@ -1755,7 +1755,7 b' var IPython = (function (IPython) {'
1755 var notebook_name = data.name;
1755 var notebook_name = data.name;
1756 window.open(
1756 window.open(
1757 utils.url_join_encode(
1757 utils.url_join_encode(
1758 base_project_url,
1758 base_url,
1759 'notebooks',
1759 'notebooks',
1760 path,
1760 path,
1761 notebook_name
1761 notebook_name
@@ -1765,7 +1765,7 b' var IPython = (function (IPython) {'
1765 }
1765 }
1766 };
1766 };
1767 var url = utils.url_join_encode(
1767 var url = utils.url_join_encode(
1768 base_project_url,
1768 base_url,
1769 'api/notebooks',
1769 'api/notebooks',
1770 path
1770 path
1771 );
1771 );
@@ -1775,7 +1775,7 b' var IPython = (function (IPython) {'
1775
1775
1776 Notebook.prototype.copy_notebook = function(){
1776 Notebook.prototype.copy_notebook = function(){
1777 var path = this.notebook_path;
1777 var path = this.notebook_path;
1778 var base_project_url = this.base_project_url;
1778 var base_url = this.base_url;
1779 var settings = {
1779 var settings = {
1780 processData : false,
1780 processData : false,
1781 cache : false,
1781 cache : false,
@@ -1785,7 +1785,7 b' var IPython = (function (IPython) {'
1785 async : false,
1785 async : false,
1786 success : function (data, status, xhr) {
1786 success : function (data, status, xhr) {
1787 window.open(utils.url_join_encode(
1787 window.open(utils.url_join_encode(
1788 base_project_url,
1788 base_url,
1789 'notebooks',
1789 'notebooks',
1790 data.path,
1790 data.path,
1791 data.name
1791 data.name
@@ -1793,7 +1793,7 b' var IPython = (function (IPython) {'
1793 }
1793 }
1794 };
1794 };
1795 var url = utils.url_join_encode(
1795 var url = utils.url_join_encode(
1796 base_project_url,
1796 base_url,
1797 'api/notebooks',
1797 'api/notebooks',
1798 path
1798 path
1799 );
1799 );
@@ -1818,7 +1818,7 b' var IPython = (function (IPython) {'
1818 };
1818 };
1819 $([IPython.events]).trigger('rename_notebook.Notebook', data);
1819 $([IPython.events]).trigger('rename_notebook.Notebook', data);
1820 var url = utils.url_join_encode(
1820 var url = utils.url_join_encode(
1821 this.base_project_url,
1821 this.base_url,
1822 'api/notebooks',
1822 'api/notebooks',
1823 this.notebook_path,
1823 this.notebook_path,
1824 this.notebook_name
1824 this.notebook_name
@@ -1835,7 +1835,7 b' var IPython = (function (IPython) {'
1835 dataType: "json",
1835 dataType: "json",
1836 };
1836 };
1837 var url = utils.url_join_encode(
1837 var url = utils.url_join_encode(
1838 this.base_project_url,
1838 this.base_url,
1839 'api/notebooks',
1839 'api/notebooks',
1840 this.notebook_path,
1840 this.notebook_path,
1841 this.notebook_name
1841 this.notebook_name
@@ -1903,7 +1903,7 b' var IPython = (function (IPython) {'
1903 };
1903 };
1904 $([IPython.events]).trigger('notebook_loading.Notebook');
1904 $([IPython.events]).trigger('notebook_loading.Notebook');
1905 var url = utils.url_join_encode(
1905 var url = utils.url_join_encode(
1906 this.base_project_url,
1906 this.base_url,
1907 'api/notebooks',
1907 'api/notebooks',
1908 this.notebook_path,
1908 this.notebook_path,
1909 this.notebook_name
1909 this.notebook_name
@@ -2054,7 +2054,7 b' var IPython = (function (IPython) {'
2054 */
2054 */
2055 Notebook.prototype.list_checkpoints = function () {
2055 Notebook.prototype.list_checkpoints = function () {
2056 var url = utils.url_join_encode(
2056 var url = utils.url_join_encode(
2057 this.base_project_url,
2057 this.base_url,
2058 'api/notebooks',
2058 'api/notebooks',
2059 this.notebook_path,
2059 this.notebook_path,
2060 this.notebook_name,
2060 this.notebook_name,
@@ -2105,7 +2105,7 b' var IPython = (function (IPython) {'
2105 */
2105 */
2106 Notebook.prototype.create_checkpoint = function () {
2106 Notebook.prototype.create_checkpoint = function () {
2107 var url = utils.url_join_encode(
2107 var url = utils.url_join_encode(
2108 this.base_project_url,
2108 this.base_url,
2109 'api/notebooks',
2109 'api/notebooks',
2110 this.notebook_path,
2110 this.notebook_path,
2111 this.notebook_name,
2111 this.notebook_name,
@@ -2192,7 +2192,7 b' var IPython = (function (IPython) {'
2192 Notebook.prototype.restore_checkpoint = function (checkpoint) {
2192 Notebook.prototype.restore_checkpoint = function (checkpoint) {
2193 $([IPython.events]).trigger('notebook_restoring.Notebook', checkpoint);
2193 $([IPython.events]).trigger('notebook_restoring.Notebook', checkpoint);
2194 var url = utils.url_join_encode(
2194 var url = utils.url_join_encode(
2195 this.base_project_url,
2195 this.base_url,
2196 'api/notebooks',
2196 'api/notebooks',
2197 this.notebook_path,
2197 this.notebook_path,
2198 this.notebook_name,
2198 this.notebook_name,
@@ -2240,7 +2240,7 b' var IPython = (function (IPython) {'
2240 Notebook.prototype.delete_checkpoint = function (checkpoint) {
2240 Notebook.prototype.delete_checkpoint = function (checkpoint) {
2241 $([IPython.events]).trigger('notebook_restoring.Notebook', checkpoint);
2241 $([IPython.events]).trigger('notebook_restoring.Notebook', checkpoint);
2242 var url = utils.url_join_encode(
2242 var url = utils.url_join_encode(
2243 this.base_project_url,
2243 this.base_url,
2244 'api/notebooks',
2244 'api/notebooks',
2245 this.notebook_path,
2245 this.notebook_path,
2246 this.notebook_name,
2246 this.notebook_name,
@@ -20,7 +20,7 b' var IPython = (function (IPython) {'
20 this.notebook = notebook;
20 this.notebook = notebook;
21 this.name = notebook.notebook_name;
21 this.name = notebook.notebook_name;
22 this.path = notebook.notebook_path;
22 this.path = notebook.notebook_path;
23 this.base_project_url = notebook.base_project_url;
23 this.base_url = notebook.base_url;
24 this.base_kernel_url = options.base_kernel_url || utils.get_data("baseKernelUrl");
24 this.base_kernel_url = options.base_kernel_url || utils.get_data("baseKernelUrl");
25 };
25 };
26
26
@@ -45,7 +45,7 b' var IPython = (function (IPython) {'
45 }
45 }
46 },
46 },
47 };
47 };
48 var url = utils.url_join_encode(this.base_project_url, 'api/sessions');
48 var url = utils.url_join_encode(this.base_url, 'api/sessions');
49 $.ajax(url, settings);
49 $.ajax(url, settings);
50 };
50 };
51
51
@@ -65,7 +65,7 b' var IPython = (function (IPython) {'
65 data: JSON.stringify(model),
65 data: JSON.stringify(model),
66 dataType : "json",
66 dataType : "json",
67 };
67 };
68 var url = utils.url_join_encode(this.base_project_url, 'api/sessions', this.id);
68 var url = utils.url_join_encode(this.base_url, 'api/sessions', this.id);
69 $.ajax(url, settings);
69 $.ajax(url, settings);
70 };
70 };
71
71
@@ -77,7 +77,7 b' var IPython = (function (IPython) {'
77 dataType : "json",
77 dataType : "json",
78 };
78 };
79 this.kernel.running = false;
79 this.kernel.running = false;
80 var url = utils.url_join_encode(this.base_project_url, 'api/sessions', this.id);
80 var url = utils.url_join_encode(this.base_url, 'api/sessions', this.id);
81 $.ajax(url, settings);
81 $.ajax(url, settings);
82 };
82 };
83
83
@@ -23,7 +23,7 b' var IPython = (function (IPython) {'
23 }
23 }
24 options = options || {};
24 options = options || {};
25 this.options = options;
25 this.options = options;
26 this.base_project_url = options.base_project_url || utils.get_data("baseProjectUrl");
26 this.base_url = options.base_url || utils.get_data("baseUrl");
27 this.notebook_path = options.notebook_path || utils.get_data("notebookPath");
27 this.notebook_path = options.notebook_path || utils.get_data("notebookPath");
28 };
28 };
29
29
@@ -51,7 +51,7 b' var IPython = (function (IPython) {'
51 dataType : "json",
51 dataType : "json",
52 success : $.proxy(this.load_list_success, this)
52 success : $.proxy(this.load_list_success, this)
53 };
53 };
54 var url = utils.url_join_encode(this.base_project_url, 'clusters');
54 var url = utils.url_join_encode(this.base_url, 'clusters');
55 $.ajax(url, settings);
55 $.ajax(url, settings);
56 };
56 };
57
57
@@ -75,7 +75,7 b' var IPython = (function (IPython) {'
75
75
76 var ClusterItem = function (element, options) {
76 var ClusterItem = function (element, options) {
77 this.element = $(element);
77 this.element = $(element);
78 this.base_project_url = options.base_project_url || utils.get_data("baseProjectUrl");
78 this.base_url = options.base_url || utils.get_data("baseUrl");
79 this.notebook_path = options.notebook_path || utils.get_data("notebookPath");
79 this.notebook_path = options.notebook_path || utils.get_data("notebookPath");
80 this.data = null;
80 this.data = null;
81 this.style();
81 this.style();
@@ -135,7 +135,7 b' var IPython = (function (IPython) {'
135 };
135 };
136 status_col.text('starting');
136 status_col.text('starting');
137 var url = utils.url_join_encode(
137 var url = utils.url_join_encode(
138 that.base_project_url,
138 that.base_url,
139 'clusters',
139 'clusters',
140 that.data.profile,
140 that.data.profile,
141 'start'
141 'start'
@@ -177,7 +177,7 b' var IPython = (function (IPython) {'
177 };
177 };
178 status_col.text('stopping');
178 status_col.text('stopping');
179 var url = utils.url_join_encode(
179 var url = utils.url_join_encode(
180 that.base_project_url,
180 that.base_url,
181 'clusters',
181 'clusters',
182 that.data.profile,
182 that.data.profile,
183 'stop'
183 'stop'
@@ -19,7 +19,7 b' $(document).ready(function () {'
19 });
19 });
20
20
21 var opts = {
21 var opts = {
22 base_project_url : IPython.utils.get_data("baseProjectUrl"),
22 base_url : IPython.utils.get_data("baseUrl"),
23 notebook_path : IPython.utils.get_data("notebookPath"),
23 notebook_path : IPython.utils.get_data("notebookPath"),
24 };
24 };
25 IPython.notebook_list = new IPython.NotebookList('#notebook_list', opts);
25 IPython.notebook_list = new IPython.NotebookList('#notebook_list', opts);
@@ -23,7 +23,7 b' var IPython = (function (IPython) {'
23 }
23 }
24 this.notebooks_list = [];
24 this.notebooks_list = [];
25 this.sessions = {};
25 this.sessions = {};
26 this.base_project_url = options.base_project_url || utils.get_data("baseProjectUrl");
26 this.base_url = options.base_url || utils.get_data("baseUrl");
27 this.notebook_path = options.notebook_path || utils.get_data("notebookPath");
27 this.notebook_path = options.notebook_path || utils.get_data("notebookPath");
28 };
28 };
29
29
@@ -106,7 +106,7 b' var IPython = (function (IPython) {'
106 dataType : "json",
106 dataType : "json",
107 success : $.proxy(that.sessions_loaded, this)
107 success : $.proxy(that.sessions_loaded, this)
108 };
108 };
109 var url = utils.url_join_encode(this.base_project_url, 'api/sessions');
109 var url = utils.url_join_encode(this.base_url, 'api/sessions');
110 $.ajax(url,settings);
110 $.ajax(url,settings);
111 };
111 };
112
112
@@ -146,7 +146,7 b' var IPython = (function (IPython) {'
146 };
146 };
147
147
148 var url = utils.url_join_encode(
148 var url = utils.url_join_encode(
149 this.base_project_url,
149 this.base_url,
150 'api',
150 'api',
151 'notebooks',
151 'notebooks',
152 this.notebook_path
152 this.notebook_path
@@ -227,7 +227,7 b' var IPython = (function (IPython) {'
227 item.find("a.item_link")
227 item.find("a.item_link")
228 .attr('href',
228 .attr('href',
229 utils.url_join_encode(
229 utils.url_join_encode(
230 this.base_project_url,
230 this.base_url,
231 "tree",
231 "tree",
232 path,
232 path,
233 name
233 name
@@ -244,7 +244,7 b' var IPython = (function (IPython) {'
244 item.find("a.item_link")
244 item.find("a.item_link")
245 .attr('href',
245 .attr('href',
246 utils.url_join_encode(
246 utils.url_join_encode(
247 this.base_project_url,
247 this.base_url,
248 "notebooks",
248 "notebooks",
249 path,
249 path,
250 nbname
250 nbname
@@ -285,7 +285,7 b' var IPython = (function (IPython) {'
285 }
285 }
286 };
286 };
287 var url = utils.url_join_encode(
287 var url = utils.url_join_encode(
288 that.base_project_url,
288 that.base_url,
289 'api/sessions',
289 'api/sessions',
290 session
290 session
291 );
291 );
@@ -325,7 +325,7 b' var IPython = (function (IPython) {'
325 }
325 }
326 };
326 };
327 var url = utils.url_join_encode(
327 var url = utils.url_join_encode(
328 notebooklist.base_project_url,
328 notebooklist.base_url,
329 'api/notebooks',
329 'api/notebooks',
330 notebooklist.notebook_path,
330 notebooklist.notebook_path,
331 nbname
331 nbname
@@ -374,7 +374,7 b' var IPython = (function (IPython) {'
374 };
374 };
375
375
376 var url = utils.url_join_encode(
376 var url = utils.url_join_encode(
377 that.base_project_url,
377 that.base_url,
378 'api/notebooks',
378 'api/notebooks',
379 that.notebook_path,
379 that.notebook_path,
380 nbname
380 nbname
@@ -397,7 +397,7 b' var IPython = (function (IPython) {'
397
397
398 NotebookList.prototype.new_notebook = function(){
398 NotebookList.prototype.new_notebook = function(){
399 var path = this.notebook_path;
399 var path = this.notebook_path;
400 var base_project_url = this.base_project_url;
400 var base_url = this.base_url;
401 var settings = {
401 var settings = {
402 processData : false,
402 processData : false,
403 cache : false,
403 cache : false,
@@ -408,7 +408,7 b' var IPython = (function (IPython) {'
408 var notebook_name = data.name;
408 var notebook_name = data.name;
409 window.open(
409 window.open(
410 utils.url_join_encode(
410 utils.url_join_encode(
411 base_project_url,
411 base_url,
412 'notebooks',
412 'notebooks',
413 path,
413 path,
414 notebook_name),
414 notebook_name),
@@ -417,7 +417,7 b' var IPython = (function (IPython) {'
417 }
417 }
418 };
418 };
419 var url = utils.url_join_encode(
419 var url = utils.url_join_encode(
420 base_project_url,
420 base_url,
421 'api/notebooks',
421 'api/notebooks',
422 path
422 path
423 );
423 );
@@ -20,7 +20,7 b''
20 <div class="container">
20 <div class="container">
21 <div class="center-nav">
21 <div class="center-nav">
22 <p class="navbar-text nav">Password:</p>
22 <p class="navbar-text nav">Password:</p>
23 <form action="{{base_project_url}}login?next={{next}}" method="post" class="navbar-form pull-left">
23 <form action="{{base_url}}login?next={{next}}" method="post" class="navbar-form pull-left">
24 <input type="password" name="password" id="password_input">
24 <input type="password" name="password" id="password_input">
25 <button type="submit" id="login_submit">Log in</button>
25 <button type="submit" id="login_submit">Log in</button>
26 </form>
26 </form>
@@ -21,9 +21,9 b''
21 {% endif %}
21 {% endif %}
22
22
23 {% if not login_available %}
23 {% if not login_available %}
24 Proceed to the <a href="{{base_project_url}}">dashboard</a>.
24 Proceed to the <a href="{{base_url}}">dashboard</a>.
25 {% else %}
25 {% else %}
26 Proceed to the <a href="{{base_project_url}}login">login page</a>.
26 Proceed to the <a href="{{base_url}}login">login page</a>.
27 {% endif %}
27 {% endif %}
28
28
29
29
@@ -22,7 +22,7 b' window.mathjax_url = "{{mathjax_url}}";'
22 {% block params %}
22 {% block params %}
23
23
24 data-project="{{project}}"
24 data-project="{{project}}"
25 data-base-project-url="{{base_project_url}}"
25 data-base-url="{{base_url}}"
26 data-base-kernel-url="{{base_kernel_url}}"
26 data-base-kernel-url="{{base_kernel_url}}"
27 data-notebook-name="{{notebook_name}}"
27 data-notebook-name="{{notebook_name}}"
28 data-notebook-path="{{notebook_path}}"
28 data-notebook-path="{{notebook_path}}"
@@ -21,7 +21,7 b''
21 require.config({
21 require.config({
22 baseUrl: '{{static_url("")}}',
22 baseUrl: '{{static_url("")}}',
23 paths: {
23 paths: {
24 nbextensions : '{{ base_project_url }}nbextensions',
24 nbextensions : '{{ base_url }}nbextensions',
25 underscore : '{{static_url("components/underscore/underscore-min")}}',
25 underscore : '{{static_url("components/underscore/underscore-min")}}',
26 backbone : '{{static_url("components/backbone/backbone-min")}}',
26 backbone : '{{static_url("components/backbone/backbone-min")}}',
27 },
27 },
@@ -54,7 +54,7 b''
54 <div id="header" class="navbar navbar-static-top">
54 <div id="header" class="navbar navbar-static-top">
55 <div class="navbar-inner navbar-nobg">
55 <div class="navbar-inner navbar-nobg">
56 <div class="container">
56 <div class="container">
57 <div id="ipython_notebook" class="nav brand pull-left"><a href="{{base_project_url}}tree/{{notebook_path}}" alt='dashboard'><img src='{{static_url("base/images/ipynblogo.png") }}' alt='IPython Notebook'/></a></div>
57 <div id="ipython_notebook" class="nav brand pull-left"><a href="{{base_url}}tree/{{notebook_path}}" alt='dashboard'><img src='{{static_url("base/images/ipynblogo.png") }}' alt='IPython Notebook'/></a></div>
58
58
59 {% block login_widget %}
59 {% block login_widget %}
60
60
@@ -11,7 +11,7 b''
11 {% block params %}
11 {% block params %}
12
12
13 data-project="{{project}}"
13 data-project="{{project}}"
14 data-base-project-url="{{base_project_url}}"
14 data-base-url="{{base_url}}"
15 data-notebook-path="{{notebook_path}}"
15 data-notebook-path="{{notebook_path}}"
16 data-base-kernel-url="{{base_kernel_url}}"
16 data-base-kernel-url="{{base_kernel_url}}"
17
17
@@ -30,12 +30,12 b' class TreeHandler(IPythonHandler):'
30 """Render the tree view, listing notebooks, clusters, etc."""
30 """Render the tree view, listing notebooks, clusters, etc."""
31
31
32 def generate_breadcrumbs(self, path):
32 def generate_breadcrumbs(self, path):
33 breadcrumbs = [(url_escape(url_path_join(self.base_project_url, 'tree')), '')]
33 breadcrumbs = [(url_escape(url_path_join(self.base_url, 'tree')), '')]
34 comps = path.split('/')
34 comps = path.split('/')
35 ncomps = len(comps)
35 ncomps = len(comps)
36 for i in range(ncomps):
36 for i in range(ncomps):
37 if comps[i]:
37 if comps[i]:
38 link = url_escape(url_path_join(self.base_project_url, 'tree', *comps[0:i+1]))
38 link = url_escape(url_path_join(self.base_url, 'tree', *comps[0:i+1]))
39 breadcrumbs.append((link, comps[i]))
39 breadcrumbs.append((link, comps[i]))
40 return breadcrumbs
40 return breadcrumbs
41
41
@@ -57,7 +57,7 b' class TreeHandler(IPythonHandler):'
57 if name is not None:
57 if name is not None:
58 # is a notebook, redirect to notebook handler
58 # is a notebook, redirect to notebook handler
59 url = url_escape(url_path_join(
59 url = url_escape(url_path_join(
60 self.base_project_url, 'notebooks', path, name
60 self.base_url, 'notebooks', path, name
61 ))
61 ))
62 self.log.debug("Redirecting %s to %s", self.request.path, url)
62 self.log.debug("Redirecting %s to %s", self.request.path, url)
63 self.redirect(url)
63 self.redirect(url)
@@ -81,7 +81,7 b' class TreeRedirectHandler(IPythonHandler):'
81 @web.authenticated
81 @web.authenticated
82 def get(self, path=''):
82 def get(self, path=''):
83 url = url_escape(url_path_join(
83 url = url_escape(url_path_join(
84 self.base_project_url, 'tree', path.strip('/')
84 self.base_url, 'tree', path.strip('/')
85 ))
85 ))
86 self.log.debug("Redirecting %s to %s", self.request.path, url)
86 self.log.debug("Redirecting %s to %s", self.request.path, url)
87 self.redirect(url)
87 self.redirect(url)
General Comments 0
You need to be logged in to leave comments. Login now