Commit Graph

376 Commits

Author SHA1 Message Date
Paul Ivanov
6c8cccf9e3 fix test suite
is_hidden expects the file to actually exist, so I've rearranged the
logic such that is_hidden is called only after it's clear that the file
exists.
2014-03-03 16:02:07 -08:00
MinRK
052955a84a normalize unicode in notebook API tests
was failing comparison on OS X
2014-03-03 14:33:45 -08:00
Paul Ivanov
d6f2dfefea log refusal to serve hidden files dirs 2014-03-03 12:35:37 -08:00
Thomas Kluyver
8c1c18461c Fix a couple of static analysis warnings 2014-02-28 11:38:28 -08:00
Thomas Kluyver
3698563794 Make hidden directories configurable 2014-02-28 11:37:26 -08:00
Thomas Kluyver
c75d4e9962 Don't attempt locale-aware sorting for now.
On Python 2, locale.strxfrm() can't handle unicode.
2014-02-28 11:35:49 -08:00
Thomas Kluyver
4fe9f8d057 Case insensitive sorting in the dashboard.
Closes gh-5151
2014-02-28 11:35:04 -08:00
Thomas Kluyver
c1e8ddc64e Hide directories beginning with _ from the dashboard.
Closes gh-5152
2014-02-28 11:31:58 -08:00
MinRK
d37780c6a6 use config instead of App.instance to propagate notebook_dir
Should behave more logically (I hope).
2014-02-21 13:22:57 -08:00
MinRK
cb25736a24 reorganize who knows what about paths
- add NotebookApp.notebook_dir
- add KernelManager.root_dir
- remove NotebookManager.notebook_dir, move to FileNBM.notebook_dir

Default value for KM.root_dir and fNBM.notebook_dir is NotebookApp.notebook_dir, but they can be configured separately.

SessionManager passes the API path to KernelManager,
which is responsible for turning it into the kernel's cwd.
2014-02-21 13:22:56 -08:00
MinRK
37cb0fbdee remove websocket url
websockets should follow the kernel URL

(normal behavior is unchanged, only unused configurability is removed)
2014-02-20 22:54:36 -08:00
Brian E. Granger
db4960769b Merge pull request #5100 from minrk/base_kernel_url
remove base_kernel_url
2014-02-20 17:00:38 -08:00
MinRK
a184724bdb remove base_kernel_url 2014-02-11 21:26:10 -08:00
Konrad Hinsen
fdb8ab37ae Rearrange the NotebookManager methods for clarity
Methods are organized into three categories:
 - Methods that must be implemented in subclasses
 - Methods that have default implementations, but can
   be overridden if required.
 - Support methods meant to be called by methods in subclasses
2014-02-11 12:30:19 +01:00
Konrad Hinsen
b1c6ba2c97 Move method increment_filename from FileNotebookManager to NotebookManager
The implementation requires only a minor change (call notebook_exists
rather than checking for file existence) to be universally usable
in other notebook managers.
2014-02-11 12:26:57 +01:00
Konrad Hinsen
0a430f5840 Add method notebook_exists to NotebookManager.
It is called by IPython.html.notebook.NotebookHandler.get,
so it must be implemented by every notebook handler.
2014-02-11 12:26:06 +01:00
Konrad Hinsen
26e3e31ad8 NotebookManager API: rename *notebook_model methods to *notebook 2014-02-11 12:25:57 +01:00
MinRK
e1e0b19a6a s/base_project_url/base_url/
deprecate NotebookApp.base_project_url
2014-02-08 23:09:24 -08:00
Brian E. Granger
eb9e0be218 Small refactoring of is_hidden to take root as default kwarg. 2014-02-05 16:43:11 -08:00
Brian E. Granger
243392d810 Creating and testing IPython.html.utils.is_hidden. 2014-02-05 13:09:55 -08:00
Brian E. Granger
7e1a179a7c Addressing review comments.
* list_dirs and get_dir_model added to base NBM class.
* Calling of list_dirs moved to handler.
* type=notebook added to notebook model.
2014-02-05 12:01:11 -08:00
Brian E. Granger
717f031e01 Adding dashboard navigation tests for dir browsing. 2014-02-04 15:53:28 -08:00
Brian E. Granger
c1a8f5af6a Get the existing tests working. 2014-02-04 15:53:28 -08:00
Brian E. Granger
45a8d046c8 Add support for index.ipynb 2014-02-04 15:52:49 -08:00
Brian E. Granger
a3ef3109db Server side logic for directories. 2014-02-04 15:52:49 -08:00
MinRK
eb208b2d77 move signature checking to base NotebookManager
so that subclasses have less to duplicate
2014-01-29 14:37:00 -08:00
MinRK
6dd44de19f Notaries sign notebooks now 2014-01-28 18:44:49 -08:00
MinRK
ffb3523d05 use configured scheme, not stored scheme when checking signatures
protects against notebook author choosing bad hash scheme.
2014-01-28 18:44:49 -08:00
MinRK
6a1e7fe685 add nbformat.sign.NotebookNotary 2014-01-28 18:44:49 -08:00
MinRK
f14f856edb sign notebooks 2014-01-28 18:44:48 -08:00
MinRK
7ae363f6d1 turn missing dependencies in nbconvert to 500 errors
pygments is the only such example at this time
2014-01-07 15:15:57 -08:00
MinRK
91d3326923 allow notebook to start without nbconvert
catches import / key errors and turns them into proper http errors
2013-12-23 12:39:27 -08:00
Thomas Kluyver
57642b3847 Move notebook URL fragment regexen into IPython.html.base.handlers 2013-12-19 13:01:00 -08:00
Thomas Kluyver
30e8939a27 Separate listing nbconvert exporters to /api/nbconvert 2013-12-13 14:46:51 -08:00
Thomas Kluyver
7655ce579e Add HTTP handlers for nbconvert 2013-12-13 14:46:50 -08:00
MinRK
b82b4997e7 test that rename fails with 409 if it would clobber
(test already passes, but it should still be tested)

closes #4600
2013-11-25 23:20:23 -08:00
Thomas Kluyver
79c27df217 Specify encoding in remainining instances of io.open 2013-11-20 10:50:04 -08:00
Thomas Kluyver
3fb55970be Miscellaneous docs fixes 2013-11-14 11:21:32 -08:00
Thomas Kluyver
b829043a60 Add test for saving notebook with .py script 2013-11-05 17:43:36 -08:00
Thomas Kluyver
8ed3a725f3 Pass nbformat object to write call to save .py script
Closes gh-4495
2013-11-05 17:35:36 -08:00
Thomas Kluyver
557fb3f4ae Python 3 compatibility for os.getcwdu() 2013-10-31 12:37:45 -07:00
Thomas Kluyver
93ee2d7173 Make sessions REST API test more robust.
Was seeing failures on Windows because it failed to delete the folder.
2013-10-29 09:15:57 -07:00
Thomas Kluyver
bce32ec03b Fixes for notebook session manager 2013-10-29 09:15:56 -07:00
Thomas Kluyver
4a14ed7e22 Replace references to unicode and basestring 2013-10-29 09:15:54 -07:00
Thomas Kluyver
d4532983f4 Convert print statements to print function calls
libmodernize.fixes.fix_print
2013-10-29 09:14:15 -07:00
Min RK
c3e6e625a7 Merge pull request #4427 from minrk/checkpoint-on-first-save
notebooks should always have one checkpoint

closes #4396
2013-10-25 13:36:59 -07:00
MinRK
6bc2c65c83 notebooks should always have one checkpoint
closes #4396
2013-10-23 10:37:49 -07:00
MinRK
3a4d719033 fix checkpoint filename 2013-10-23 10:37:08 -07:00
MinRK
922f458d6a set kernel cwd to notebook's directory
closes #4424
2013-10-23 10:15:55 -07:00
MinRK
40cce4d7e3 s/os.path.sep/os.sep/ 2013-10-22 17:36:34 -07:00
MinRK
dfb538d881 Windows testing fixes 2013-10-22 17:16:31 -07:00
MinRK
1f90f4d7bb test /files/ gives 403 on hidden files 2013-10-22 15:23:46 -07:00
MinRK
24174f31d9 use itertools.count for incrementing notebook filename 2013-10-20 14:09:01 -07:00
MinRK
cc08837111 fix created timestamp in notebook model 2013-10-20 14:08:47 -07:00
MinRK
f894dbe664 test upload of v2 notebooks 2013-10-18 19:30:52 -07:00
MinRK
cf0218e2d1 don't use jsonapi in test_notebook_api 2013-10-18 16:35:52 -07:00
MinRK
66ccce69c6 copy_from in json, not in url param 2013-10-18 16:35:03 -07:00
MinRK
ef0d065712 test nbmanager.copy_notebook 2013-10-18 16:13:54 -07:00
MinRK
7ea311ad64 escape URLs in Location headers 2013-10-18 16:13:53 -07:00
MinRK
06d9b99141 update notebook api tests
with creation URL changes

also use unicode as the default name in tests,
to increase likelihood of catching unicode bugs.
2013-10-18 16:13:53 -07:00
MinRK
f11caf25e7 update notebook creation handlers
- only POST to directories (notebook picks name)
- only PUT to full paths
- PUT and POST should be equivalent aside from
  who picks the notebook name.
2013-10-18 16:13:53 -07:00
MinRK
60d12e4209 allow specifying destination in copy_notebook 2013-10-17 19:39:06 -07:00
MinRK
d1a36fe4c0 use 'id' for checkpoint ID key
rather than redundant checkpoint.checkpoint_id
2013-10-17 14:55:00 -07:00
Brian E. Granger
36aa39e3b7 Improving tests and setting of Location header. 2013-10-17 14:09:20 -07:00
Brian E. Granger
51fc769edd Handle notebook downloads through the /files URL. 2013-10-17 14:09:20 -07:00
Brian E. Granger
59901ce88c Adding docstring to NotebookHandler.get. 2013-10-17 14:09:19 -07:00
Thomas Kluyver
6017f5d0ef Specify encoding for loading and saving notebooks. 2013-10-17 14:09:19 -07:00
Thomas Kluyver
05e85588cf Add some unicode testing for saving notebooks 2013-10-17 14:09:19 -07:00
Thomas Kluyver
cbc141c95c Fixes for notebook checkpoint APIs 2013-10-17 14:09:19 -07:00
Thomas Kluyver
3f46a05a14 Test notebook checkpoint APIs 2013-10-17 14:09:19 -07:00
MinRK
4a12890d65 disable download-as-pt
since it doesn't work. Adds a note about nbconvert needed to bring it back.
2013-10-17 14:09:19 -07:00
Thomas Kluyver
d089f7749f Use assertEqual, not deprecated assertEquals 2013-10-17 14:09:19 -07:00
Thomas Kluyver
836ad5f388 Add tests for interrupting & restarting kernel
These are in an existing test method, as starting and stopping kernels
for individual tests is expensive.
2013-10-17 14:09:19 -07:00
Thomas Kluyver
06fa301908 Refactor tests for kernels REST API 2013-10-17 14:09:18 -07:00
MinRK
8b9bb04d12 review pass on Sessions API 2013-10-17 14:09:18 -07:00
Thomas Kluyver
b1a0f2e8cc 404 on attempt to list notebooks in nonexistant directory 2013-10-17 14:09:18 -07:00
Thomas Kluyver
18f88d020f Add failing test for listing nonexistant directory 2013-10-17 14:09:18 -07:00
Thomas Kluyver
99969474e0 Fix notebook manager test 2013-10-17 14:09:17 -07:00
Thomas Kluyver
c18aaefbde Fix sessionmanager test 2013-10-17 14:09:17 -07:00
Thomas Kluyver
e240f21ea1 Clean up sessions code from static analysis 2013-10-17 14:09:17 -07:00
Thomas Kluyver
693cc97905 Fix some HTTP status codes in sessions API 2013-10-17 14:09:17 -07:00
Thomas Kluyver
b3d2698c11 Fix session API tests 2013-10-17 14:09:17 -07:00
Thomas Kluyver
a02bd3d5e4 Improve Session REST API tests 2013-10-17 14:09:17 -07:00
Thomas Kluyver
a6a7255454 Fix some notebook model tests 2013-10-17 14:09:17 -07:00
MinRK
acb4245035 unicode normalization in test_notebooks_api 2013-10-17 14:09:17 -07:00
Thomas Kluyver
9f4a4ab3f8 Check Location header from renaming notebook 2013-10-17 14:09:16 -07:00
Thomas Kluyver
9144e8e57b Fix check of notebook path 2013-10-17 14:09:16 -07:00
Thomas Kluyver
eb9a55ed6b Add test for and fix REST save with rename 2013-10-17 14:09:16 -07:00
Thomas Kluyver
b9310d0e05 Add test for copying notebook through REST API 2013-10-17 14:09:16 -07:00
Thomas Kluyver
7725025d52 Add test for saving notebook via REST API 2013-10-17 14:09:16 -07:00
Thomas Kluyver
85d3c39b5a Add test for REST API uploading notebook 2013-10-17 14:09:16 -07:00
Thomas Kluyver
9d9adb1186 Improve tests for notebook REST API 2013-10-17 14:09:15 -07:00
MinRK
6c88abe1d6 always set location on PATCH
don't redirect
2013-10-17 14:09:15 -07:00
MinRK
dc65b33d14 simplify handler patterns
PATH pattern will now sometimes include leading slash,
but that's okay because nbmanager will strip them.

fewer redirect patterns needed
2013-10-17 14:09:15 -07:00
MinRK
a31cfdc8a8 ensure 'path' never has leading or trailing slash in nbmanager
Don't trust API callers to always get this right.
2013-10-17 14:09:15 -07:00
MinRK
a7f297f8f3 save before download-as
uses `async : false`

closes #852

download-as-py still unavailable.
2013-10-17 14:09:15 -07:00
MinRK
8b94ee2b47 use async : false to avoid pop-up blocker on New / Copy notebook 2013-10-17 14:09:14 -07:00
MinRK
b33ffa7068 update upload and copy
adds 'notebook.ipynb/copy' url handler

because we were putting too many things in a single POST handler.
2013-10-17 14:09:14 -07:00
MinRK
4e12521082 fix dashboard upload 2013-10-17 14:09:14 -07:00
MinRK
5b1a648fc8 move os_path to FileNBMan
doesn't belong in base NotebookManager
2013-10-17 14:09:14 -07:00
MinRK
fe59217989 move url_[un]escape to utils from nbm 2013-10-17 14:09:13 -07:00
MinRK
16e8d0ff43 adjust definition of 'path' in notebooks
never includes leading or trailing '/'
2013-10-17 14:09:13 -07:00
MinRK
e46412e30f fix --notebook-dir configurable when there is no trailing slash 2013-10-17 14:09:13 -07:00
Zachary Sailer
d3e456d9a1 add tests to notebooks api
- check for correct status codes
- check headers location
- fix COPY api
2013-10-17 14:09:12 -07:00
Zachary Sailer
9e0beba86f adding to test_kernels_api.py
- Check all HTTP status code responses for requests
- Test invalid kernel IDs
- Check 'location' key in POST request to kernels
2013-10-17 14:09:12 -07:00
Zachary Sailer
c26700cd3a changes after session manager code review 2013-10-17 14:09:12 -07:00
Zachary Sailer
7aaaab0668 fixed notebook rename after nbmanager refactor 2013-10-17 14:09:12 -07:00
Zachary Sailer
2a946c62ab added tests to nbmanager for url encode/decode 2013-10-17 14:09:11 -07:00
Zachary Sailer
97bc426bb7 add error catching to kernel manager
also, adding further tests to kernel manager
2013-10-17 14:09:11 -07:00
Brian E. Granger
c0bc0410ce Review and refactoring of notebooks web service. 2013-10-17 14:09:11 -07:00
MinRK
5568cd5db0 ensure test_no_kernels runs first
since it expects a clean notebook server.
2013-10-17 14:09:11 -07:00
Zachary Sailer
27680dacb2 Code review changes.
Fixed handler issues and api tests from code review
from @minrk and @carreau.
2013-10-17 14:09:11 -07:00
Zachary Sailer
04c6a3cfac refactoring of nbmanager and filenbmanager
major clean up of the two managers. We make sure to follow
the standard models described in IPEP 16
2013-10-17 14:09:10 -07:00
Zachary Sailer
050a3098a8 review fixes on tests, add extra kernel api test 2013-10-17 14:09:10 -07:00
Zachary Sailer
e9ac1c2d37 add tests for session api 2013-10-17 14:09:10 -07:00
Zachary Sailer
8ce586a241 move notebooks api tests into notebooks/tests 2013-10-17 14:09:10 -07:00
Paul Ivanov
f517d44d4b removing contents changes from this PR 2013-10-17 14:09:10 -07:00
Zachary Sailer
95b505d602 Added notebooks API tests. 2013-10-17 14:09:10 -07:00
Zachary Sailer
5f1b7727d8 fix bug in test_contentmanager 2013-10-17 14:09:09 -07:00
Brian E. Granger
136a19e5eb Added base class for Notebook API tests. 2013-10-17 14:09:09 -07:00
Zachary Sailer
483d16c8ed clean kernel manager 2013-10-17 14:09:09 -07:00
Zachary Sailer
22e351ae3b cleaning nb handlers, adding doc-strings/comments 2013-10-17 14:09:09 -07:00
Zachary Sailer
8c2009874c session manager restructuring
Redid the sessionmanager, added tests for the session manager,
and added a sqlite database to hold kernel,session,nb mapping.
2013-10-17 14:09:09 -07:00
Paul Ivanov
b8318708eb clean up of get_os_path and its tests
work with @Zsailer
2013-10-17 14:09:09 -07:00
Zachary Sailer
34b9840786 fixing broken links from recent changes.
After fixing operating system path changes in previous commits,
many links needed to be adjusted to direct to the correct URL.
2013-10-17 14:09:09 -07:00
Zachary Sailer
470595f9e7 handle path separators with os.sep and add tests
Added more tests to the notebook manager to check for the correct
path separators on different operating system. Fixed the get_path
method.
2013-10-17 14:09:08 -07:00
Zachary Sailer
bdbe30dc3a url encode/decode tests added to nbmanager 2013-10-17 14:09:08 -07:00
Paul Ivanov
7ca8a21bf6 named_notebook_path: consistent usage convention 2013-10-17 14:09:08 -07:00
Paul Ivanov
a083ad1fd7 more named_notebook_path cleanup
named_notebook_path now returns path with leading and trailing slashes.
Work with @Zsailer
2013-10-17 14:09:08 -07:00
Paul Ivanov
fd7a64ff38 simplified named_notebook_path implementation
Also updated the tests
2013-10-17 14:09:08 -07:00
Paul Ivanov
9f08aa5a08 cleaning up named_notebook_path 2013-10-17 14:09:08 -07:00
Paul Ivanov
11e5bd7b24 adding tests for named_notebook_path
I want to do some refactoring, so I'll put in some tests that will define the
behavior that I want to preserve, so I can verify that my refactoring hasn't
broken anything.
2013-10-17 14:09:08 -07:00
Thomas Kluyver
18fdb26273 Fix to if test 2013-10-17 14:09:07 -07:00
Thomas Kluyver
6154c5f626 Remove some unnecessary imports 2013-10-17 14:09:07 -07:00
Thomas Kluyver
2a81c5f80c Update docstring 2013-10-17 14:09:07 -07:00
Thomas Kluyver
213b89c1cc Simplify encoding/decoding URL parts 2013-10-17 14:09:07 -07:00
Thomas Kluyver
adb2fc1fa4 Better use Python slicing 2013-10-17 14:09:07 -07:00
Zachary Sailer
1f04b48725 Renaming fixed 2013-10-17 14:09:07 -07:00
Zachary Sailer
f3af343f4f Change new/copy URLS to POST requests 2013-10-17 14:09:06 -07:00
Zachary Sailer
8261ac2cb9 change standard money keys 2013-10-17 14:09:06 -07:00
Zachary Sailer
c7375e170f rebase master- eliminate read-only 2013-10-17 14:09:06 -07:00
Zachary Sailer
eb1690255d allow spaces in notebook path 2013-10-17 14:09:06 -07:00
Zachary Sailer
a219abaeeb standard model changes 2013-10-17 14:09:06 -07:00
Zachary Sailer
5af83cd705 redirect url after notebook rename 2013-10-17 14:09:05 -07:00
Zachary Sailer
fd282698bc removing debug logs 2013-10-17 14:09:05 -07:00
Zachary Sailer
5462cb4d9b fixed delete_content in contentmanager 2013-10-17 14:09:05 -07:00
Zachary Sailer
91f25dc046 add contents web service api 2013-10-17 14:09:05 -07:00
Zachary Sailer
ad621913f1 added folder creation ability using '/-new' 2013-10-17 14:07:51 -07:00
Zachary Sailer
d06cf1fed7 added "last_modified" to notebook_model 2013-10-17 14:07:51 -07:00
Zachary Sailer
d4ee2da291 proper '.py' and '.ipynb' download files 2013-10-17 14:07:51 -07:00
Zachary Sailer
022b8324b2 Download '.py' fixed, deleted debugging output 2013-10-17 14:07:51 -07:00
Zachary Sailer
bfff3d817d Fixed bug when linking kernel to new code cells 2013-10-17 14:07:51 -07:00
Zachary Sailer
c4e06a3728 allow rename in subdirectory notebooks 2013-10-17 14:07:51 -07:00
Zachary Sailer
ece92127d3 Add 'patch' to session & notebook, rename working 2013-10-17 14:07:51 -07:00
Zachary Sailer
e4a7b724a6 fixed shutdown button refresh on dashboard 2013-10-17 14:07:51 -07:00
Zachary Sailer
62ec52e276 fix restart/interrupt kernel buttons 2013-10-17 14:07:50 -07:00
Zachary Sailer
20324bafd0 fixing path redirects, cleaning path logic 2013-10-17 14:07:50 -07:00
Zachary Sailer
11cef9ab45 fixing some bugs after rebase 2013-10-17 14:07:50 -07:00
Zachary Sailer
0559df1b8a manual rebase - add sessions web service 2013-10-17 14:07:49 -07:00
Zachary Sailer
98e67bfa22 manual rebase notebooks web services 2013-10-17 14:07:49 -07:00
Zachary Sailer
09c4ecbb10 manual rebase services/kernels/ 2013-10-17 14:07:49 -07:00
Matthias Bussonnier
e07ddebdf6 Merge pull request #3743 from minrk/noro
remove notebook read-only view

it is largely broken, and had problematic security issues.
2013-07-25 10:51:26 -07:00
MinRK
f9dd129e1c remove notebook read-only view
it is largely broken, and had problematic security issues.
2013-07-23 13:22:05 -07:00
MinRK
2a09958bb6 better message when notebook format is not supported
Different messages for bad version and bad JSON.

closes #1592
2013-07-23 12:36:22 -07:00
MinRK
39578beabc remove max_msg_size altogether
It was a security feature without an application.
2013-07-09 09:37:36 -07:00
MinRK
4408ab6ca1 warn about messages dropped due to oversize 2013-07-05 22:17:40 -07:00
MinRK
563d9372bf up default max_msg_size to 1MB 2013-07-05 22:17:39 -07:00
Brian E. Granger
7941da8fe2 Merge pull request #3498 from ellisonbg/nbname
When a notebook is written to file, name the metadata name u''.
2013-07-05 11:31:41 -07:00
Matthias Bussonnier
cefbcbead1 Merge pull request #3526 from minrk/clusterlist
ensure 'default' is first in cluster profile list

when sorting, 'default' is transformed to ''.
2013-07-05 07:35:59 -07:00
Matthias Bussonnier
8e211a1290 Merge pull request #3525 from minrk/utc
Fix basic timezone info

minor tweaks to jsonutil, to include timezone info if available
add IPython.utils.tz, which just has basic info for making utcnow(), etc. include tzinfo in the datetime object
use this tzinfo in the last_modified keys in notebook managers, which fixes Firefox's timezone offset for checkpoints
2013-07-05 07:35:27 -07:00
MinRK
13408ecf71 ensure 'default' is first in cluster profile list
when sorting, `'default'` is transformed to `''`.
2013-07-03 16:18:10 -07:00
MinRK
bc4a457fdc add timezone info to last_modified in notebook managers
now Firefox won't get confused, turning utc timestamps into local times.

closes #3396
2013-07-03 12:16:22 -07:00
Thomas Kluyver
a2bf752dba Remove unused imports in IPython.html 2013-07-02 22:31:40 +01:00
Thomas Kluyver
acb7eefef8 Remove unexpected keyword parameter to remove_kernel
Closes gh-3474
2013-06-29 23:01:34 +01:00
Brian E. Granger
a8dfc449a6 When a notebook is written to file, name the metadata name u''. 2013-06-28 21:35:20 -05:00
MinRK
cf726d6a40 mv IPython.html.notebook -> IPython.html 2013-06-27 11:14:10 -07:00