Skip to content

Commit

Permalink
Reproduce and fix the download error
Browse files Browse the repository at this point in the history
Closes #318
  • Loading branch information
mwouts committed Sep 1, 2019
1 parent 67ded3c commit 412293f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Release History
**BugFixes**

- Fix the usability of the `fmt` argument in `jupytext.read` (#312)
- Fix the download notebook error when `c.notebook_extensions` has a custom value (#318)

1.2.1 (2019-07-20)
++++++++++++++++++++++
Expand Down
4 changes: 2 additions & 2 deletions jupytext/contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def get(self, path, content=True, type=None, format=None, load_alternative_forma
path_inputs = alt_path
fmt_inputs = alt_fmt
model_outputs = model
model = self.get(alt_path, content=content, type=type, format=format,
model = self.get(alt_path, content=content, type='notebook', format=format,
load_alternative_format=False)
break
# Outputs taken from ipynb if in group, if file exists
Expand All @@ -366,7 +366,7 @@ def get(self, path, content=True, type=None, format=None, load_alternative_forma
if alt_path.endswith('.ipynb') and self.exists(alt_path):
self.log.info(u'Reading OUTPUTS from {}'.format(alt_path))
path_outputs = alt_path
model_outputs = self.get(alt_path, content=content, type=type, format=format,
model_outputs = self.get(alt_path, content=content, type='notebook', format=format,
load_alternative_format=False)
break

Expand Down
17 changes: 17 additions & 0 deletions tests/test_contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,23 @@ def test_notebook_extensions(tmpdir):
assert model['type'] == 'file'


def test_download_file_318(tmpdir):
tmp_ipynb = str(tmpdir.join('notebook.ipynb'))
tmp_py = str(tmpdir.join('notebook.py'))

nb = new_notebook()
nb.metadata['jupytext'] = {'formats': 'ipynb,py'}
write(nb, tmp_ipynb)
write(nb, tmp_py)

cm = jupytext.TextFileContentsManager()
cm.root_dir = str(tmpdir)
cm.notebook_extensions = 'ipynb'

model = cm.get('notebook.ipynb', content=True, type=None, format=None)
assert model['type'] == 'notebook'


def test_markdown_and_r_extensions(tmpdir):
tmp_r = str(tmpdir.join('script.r'))
tmp_markdown = str(tmpdir.join('notebook.markdown'))
Expand Down

0 comments on commit 412293f

Please sign in to comment.