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