File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
notebook/services/nbconvert Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
from ...base .handlers import APIHandler
6
6
7
+
7
8
class NbconvertRootHandler (APIHandler ):
8
9
9
10
@web .authenticated
10
11
def get (self ):
11
12
try :
12
- from nbconvert .exporters . export import exporter_map
13
+ from nbconvert .exporters import base
13
14
except ImportError as e :
14
15
raise web .HTTPError (500 , "Could not import nbconvert: %s" % e )
15
16
res = {}
16
- for format , exporter in exporter_map .items ():
17
- res [format ] = info = {}
18
- info ['output_mimetype' ] = exporter .output_mimetype
17
+ exporters = base .get_export_names ()
18
+ for exporter_name in exporters :
19
+ try :
20
+ exporter_class = base .get_exporter (exporter_name )
21
+ except ValueError :
22
+ # I think the only way this will happen is if the entrypoint
23
+ # is uninstalled while this method is running
24
+ continue
25
+ # XXX: According to the docs, it looks like this should be set to None
26
+ # if the exporter shouldn't be exposed to the front-end and a friendly
27
+ # name if it should. However, none of the built-in exports have it defined.
28
+ # if not exporter_class.export_from_notebook:
29
+ # continue
30
+ res [exporter_name ] = {
31
+ "output_mimetype" : exporter_class .output_mimetype ,
32
+ }
19
33
20
34
self .finish (json .dumps (res ))
21
35
You can’t perform that action at this time.
0 commit comments