15
15
from tornado .web import HTTPError
16
16
from traitlets import Bool
17
17
from traitlets .config import Configurable
18
+ from traitlets .config .configurable import LoggingConfigurable
18
19
19
20
from jupyter_server .utils import ApiPath , to_api_path , to_os_path
20
21
@@ -165,7 +166,7 @@ def _simple_writing(path, text=True, encoding="utf-8", log=None, **kwargs):
165
166
fileobj .close ()
166
167
167
168
168
- class FileManagerMixin (Configurable ):
169
+ class FileManagerMixin (LoggingConfigurable , Configurable ):
169
170
"""
170
171
Mixin for ContentsAPI classes that interact with the filesystem.
171
172
@@ -203,7 +204,7 @@ def atomic_writing(self, os_path, *args, **kwargs):
203
204
Depending on flag 'use_atomic_writing', the wrapper perform an actual atomic writing or
204
205
simply writes the file (whatever an old exists or not)"""
205
206
with self .perm_to_403 (os_path ):
206
- kwargs ["log" ] = self .log # type:ignore[attr-defined]
207
+ kwargs ["log" ] = self .log
207
208
if self .use_atomic_writing :
208
209
with atomic_writing (os_path , * args , ** kwargs ) as f :
209
210
yield f
@@ -233,7 +234,7 @@ def _copy(self, src, dest):
233
234
234
235
like shutil.copy2, but log errors in copystat
235
236
"""
236
- copy2_safe (src , dest , log = self .log ) # type:ignore[attr-defined]
237
+ copy2_safe (src , dest , log = self .log )
237
238
238
239
def _get_os_path (self , path ):
239
240
"""Given an API path, return its file system path.
@@ -252,6 +253,7 @@ def _get_os_path(self, path):
252
253
------
253
254
404: if path is outside root
254
255
"""
256
+ self .log .debug ("Reading path from disk: %s" , path )
255
257
root = os .path .abspath (self .root_dir ) # type:ignore[attr-defined]
256
258
# to_os_path is not safe if path starts with a drive, since os.path.join discards first part
257
259
if os .path .splitdrive (path )[0 ]:
@@ -359,7 +361,7 @@ async def _copy(self, src, dest):
359
361
360
362
like shutil.copy2, but log errors in copystat
361
363
"""
362
- await async_copy2_safe (src , dest , log = self .log ) # type:ignore[attr-defined]
364
+ await async_copy2_safe (src , dest , log = self .log )
363
365
364
366
async def _read_notebook (self , os_path , as_version = 4 , capture_validation_error = None ):
365
367
"""Read a notebook from an os path."""
0 commit comments