Show More
@@ -17,14 +17,12 Authors: | |||
|
17 | 17 | # Imports |
|
18 | 18 | #----------------------------------------------------------------------------- |
|
19 | 19 | |
|
20 | import datetime | |
|
21 | 20 | import io |
|
21 | import itertools | |
|
22 | 22 | import os |
|
23 | 23 | import glob |
|
24 | 24 | import shutil |
|
25 | 25 | |
|
26 | from unicodedata import normalize | |
|
27 | ||
|
28 | 26 | from tornado import web |
|
29 | 27 | |
|
30 | 28 | from .nbmanager import NotebookManager |
@@ -83,17 +81,14 class FileNotebookManager(NotebookManager): | |||
|
83 | 81 | for name in names] |
|
84 | 82 | return names |
|
85 | 83 | |
|
86 | def increment_filename(self, basename, path=''): | |
|
84 | def increment_filename(self, basename, path='', ext='.ipynb'): | |
|
87 | 85 | """Return a non-used filename of the form basename<int>.""" |
|
88 | 86 | path = path.strip('/') |
|
89 | i = 0 | |
|
90 | while True: | |
|
91 | name = u'%s%i.ipynb' % (basename,i) | |
|
87 | for i in itertools.count(): | |
|
88 | name = u'{basename}{i}{ext}'.format(basename=basename, i=i, ext=ext) | |
|
92 | 89 | os_path = self.get_os_path(name, path) |
|
93 | 90 | if not os.path.isfile(os_path): |
|
94 | 91 | break |
|
95 | else: | |
|
96 | i = i+1 | |
|
97 | 92 | return name |
|
98 | 93 | |
|
99 | 94 | def path_exists(self, path): |
General Comments 0
You need to be logged in to leave comments.
Login now