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