mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
make base64 decoding ipython3 compatible
This commit is contained in:
parent
c6d548fbeb
commit
e75cfa24df
@ -7,6 +7,8 @@ import logging
|
||||
import os
|
||||
import mimetypes
|
||||
import json
|
||||
import base64
|
||||
|
||||
try:
|
||||
# py3
|
||||
from http.client import responses
|
||||
@ -47,7 +49,8 @@ class FilesHandler(IPythonHandler):
|
||||
self.set_header('Content-Disposition','attachment; filename="%s"' % name)
|
||||
|
||||
if model['format'] == 'base64':
|
||||
self.write(model['content'].decode('base64'))
|
||||
b64_bytes = model['content'].encode('ascii')
|
||||
self.write(base64.decodestring(b64_bytes))
|
||||
elif model['format'] == 'json':
|
||||
self.write(json.dumps(model['content']))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user