Skip to content

Commit b81ac4a

Browse files
committed
Refactor directory service to include default path handling in get_content_by_path method
1 parent ef91c7b commit b81ac4a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

server/app/services/directory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def get_content_by_path(path: str = None):
1717
jupyter_api_path = app.config['JUPYTER_API_PATH']
1818
jupyter_default_path = app.config['JUPYTER_DEFAULT_PATH']
1919

20+
if path is None:
21+
path = jupyter_default_path
2022
path = f"{jupyter_api_path}/{path}"
2123
response = requests.get(path)
2224

server/tests/services/test_notebook_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_create_and_get_notebook(self):
6060

6161
self.assertTrue(notebook_name_1.startswith('notebook_'))
6262
self.assertTrue(notebook_name_1.endswith('.ipynb'))
63-
self.assertEquals('work/' + notebook_name_1, notebook_path_1)
63+
self.assertEqual('work/' + notebook_name_1, notebook_path_1)
6464

6565
get_response_1 = Notebook.get_notebook_by_path(notebook_path=notebook_path_1)
6666
notebook_1 = get_response_1[0]

0 commit comments

Comments
 (0)