AuthenticatedFileHandler uses ContentsManager to serve files and notebooks

In reference to #6613 I'm adding this PR. Rather than working on paths, it will use the current ContentsManager to get the contents of a file.

I tested this with the default `FileContentsManager` and our own `MongoContentsManager`.

There might be a better way to serve the file instead of `write()` and `flush()`.

Let me know what you think
Right. I'll put it there and leave AuthenticatedFileHandler alone.

 

-----Original Message-----
From: Min RK <notifications@github.com>
To: ipython/ipython <ipython@noreply.github.com>
Cc: Manuel Riel <m@nuelriel.com>
Sent: Sat, 04 Oct 2014 21:44
Subject: Re: [ipython] AuthenticatedFileHandler uses ContentsManager to serve files and notebooks (#6620)

> @@ -284,13 +284,22 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):
>  
>      @web.authenticated
>      def get(self, path):
> -        if os.path.splitext(path)[1] == '.ipynb':
> -            name = os.path.basename(path)
> -            self.set_header('Content-Type', 'application/json')
> +            if path.find('/') > -1:

Ah, now that I look at our code, to be consistent it would be top-level `html/files/handlers.py`.

---
Reply to this email directly or view it on GitHub:
https://github.com/ipython/ipython/pull/6620/files#r18431255