Skip to content

Commit

Permalink
Rename paired notebooks, even those that were not previously open
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Feb 27, 2019
1 parent c173f75 commit 46a4d1c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jupytext/contentsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,14 @@ def trust_notebook(self, path):

def rename_file(self, old_path, new_path):
"""Rename the current notebook, as well as its alternative representations"""
if old_path not in self.paired_notebooks:
try:
# we do not know yet if this is a paired notebook (#190)
# -> to get this information we open the notebook
self.get(old_path, content=True)
except Exception:
pass

if old_path not in self.paired_notebooks:
super(TextFileContentsManager, self).rename_file(old_path, new_path)
return
Expand Down

1 comment on commit 46a4d1c

@Atcold
Copy link

@Atcold Atcold commented on 46a4d1c Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Please sign in to comment.