Show More
@@ -222,17 +222,6 b' class NotebookHandler(IPythonHandler):' | |||
|
222 | 222 | self.finish() |
|
223 | 223 | |
|
224 | 224 | |
|
225 | class NotebookTrustHandler(IPythonHandler): | |
|
226 | ||
|
227 | SUPPORTED_METHODS = ('POST') | |
|
228 | ||
|
229 | @web.authenticated | |
|
230 | def post(self, path='', name=None): | |
|
231 | """trust the specified notebook""" | |
|
232 | self.notebook_manager.trust_notebook(name, path) | |
|
233 | self.set_status(200) | |
|
234 | ||
|
235 | ||
|
236 | 225 | class NotebookCheckpointsHandler(IPythonHandler): |
|
237 | 226 | |
|
238 | 227 | SUPPORTED_METHODS = ('GET', 'POST') |
@@ -290,7 +279,6 b' class ModifyNotebookCheckpointsHandler(IPythonHandler):' | |||
|
290 | 279 | _checkpoint_id_regex = r"(?P<checkpoint_id>[\w-]+)" |
|
291 | 280 | |
|
292 | 281 | default_handlers = [ |
|
293 | (r"/api/notebooks%s/trust" % notebook_path_regex, NotebookTrustHandler), | |
|
294 | 282 | (r"/api/notebooks%s/checkpoints" % notebook_path_regex, NotebookCheckpointsHandler), |
|
295 | 283 | (r"/api/notebooks%s/checkpoints/%s" % (notebook_path_regex, _checkpoint_id_regex), |
|
296 | 284 | ModifyNotebookCheckpointsHandler), |
@@ -1637,7 +1637,6 b' var IPython = (function (IPython) {' | |||
|
1637 | 1637 | } |
|
1638 | 1638 | } |
|
1639 | 1639 | } |
|
1640 | console.log('t', trusted, this.trusted); | |
|
1641 | 1640 | if (trusted != this.trusted) { |
|
1642 | 1641 | this.trusted = trusted; |
|
1643 | 1642 | $([IPython.events]).trigger("trust_changed.Notebook", trusted); |
@@ -1814,21 +1813,6 b' var IPython = (function (IPython) {' | |||
|
1814 | 1813 | * @method trust_notebook |
|
1815 | 1814 | */ |
|
1816 | 1815 | Notebook.prototype.trust_notebook = function (extra_settings) { |
|
1817 | // We do the call with settings so we can set cache to false. | |
|
1818 | ||
|
1819 | var settings = { | |
|
1820 | processData : false, | |
|
1821 | cache : false, | |
|
1822 | type : "POST", | |
|
1823 | success : $.proxy(this._trust_notebook_success, this), | |
|
1824 | error : $.proxy(this._trust_notebook_error, this) | |
|
1825 | }; | |
|
1826 | if (extra_settings) { | |
|
1827 | for (var key in extra_settings) { | |
|
1828 | settings[key] = extra_settings[key]; | |
|
1829 | } | |
|
1830 | } | |
|
1831 | ||
|
1832 | 1816 | var body = $("<div>").append($("<p>") |
|
1833 | 1817 | .text("A trusted IPython notebook may execute hidden malicious code ") |
|
1834 | 1818 | .append($("<strong>") |
@@ -1853,30 +1837,23 b' var IPython = (function (IPython) {' | |||
|
1853 | 1837 | Trust : { |
|
1854 | 1838 | class : "btn-danger", |
|
1855 | 1839 | click : function () { |
|
1856 | $([IPython.events]).trigger('notebook_trusting.Notebook'); | |
|
1857 |
var |
|
|
1858 |
|
|
|
1859 |
|
|
|
1860 |
|
|
|
1861 |
|
|
|
1862 |
|
|
|
1863 | ); | |
|
1864 |
|
|
|
1840 | var cells = nb.get_cells(); | |
|
1841 | for (var i = 0; i < cells.length; i++) { | |
|
1842 | var cell = cells[i]; | |
|
1843 | if (cell.cell_type == 'code') { | |
|
1844 | cell.output_area.trusted = true; | |
|
1845 | } | |
|
1846 | } | |
|
1847 | $([IPython.events]).on('notebook_saved.Notebook', function () { | |
|
1848 | window.location.reload(); | |
|
1849 | }); | |
|
1850 | nb.save_notebook(); | |
|
1865 | 1851 | } |
|
1866 | 1852 | } |
|
1867 | 1853 | } |
|
1868 | 1854 | }); |
|
1869 | 1855 | }; |
|
1870 | 1856 | |
|
1871 | Notebook.prototype._trust_notebook_success = function (data, status, xhr) { | |
|
1872 | $([IPython.events]).trigger('notebook_trusted.Notebook'); | |
|
1873 | window.location.reload(); | |
|
1874 | }; | |
|
1875 | ||
|
1876 | Notebook.prototype._trust_notebook_error = function (xhr, status, error) { | |
|
1877 | $([IPython.events]).trigger('notebook_trust_failed.Notebook', [xhr, status, error]); | |
|
1878 | }; | |
|
1879 | ||
|
1880 | 1857 | Notebook.prototype.new_notebook = function(){ |
|
1881 | 1858 | var path = this.notebook_path; |
|
1882 | 1859 | var base_url = this.base_url; |
General Comments 0
You need to be logged in to leave comments.
Login now