##// END OF EJS Templates
Adds configuration options to use Google Drive content manager...
Adds configuration options to use Google Drive content manager Adds the key contentmanager_js_source to webapp_settings that allows for specifying the content manager JavaScript source file. Also adds a NotebookManager subclass, ClientSideNotebookManager, which does minimal logic. This class is used when the JavaScript content manager doesn't use the Python notebook manager, but rather implements that logic client side, as is the case for the Google Drive based content manager. A sample command line that uses the Google Drive content manager, and the ClientSideNotebookManager, is ipython notebook --NotebookApp.webapp_settings="{'contentmanager_js_source': 'base/js/drive_contentmanager'}" --NotebookApp.notebook_manager_class="IPython.html.services.notebooks.clientsidenbmanager.ClientSideNotebookManager"

File last commit:

r13353:0ca701d5
r18639:28c27a69
Show More
ulinecache.py
45 lines | 1.6 KiB | text/x-python | PythonLexer
Thomas Kluyver
Fix getting unicode lines in IPython.core.debugger.
r8324 """Wrapper around linecache which decodes files to unicode according to PEP 263.
This is only needed for Python 2 - linecache in Python 3 does the same thing
itself.
"""
import functools
import linecache
Jörgen Stenarson
Convert filename to bytes in getlines....
r8335 import sys
Thomas Kluyver
Fix getting unicode lines in IPython.core.debugger.
r8324
from IPython.utils import py3compat
from IPython.utils import openpy
if py3compat.PY3:
getline = linecache.getline
# getlines has to be looked up at runtime, because doctests monkeypatch it.
@functools.wraps(linecache.getlines)
def getlines(filename, module_globals=None):
return linecache.getlines(filename, module_globals=module_globals)
else:
def getlines(filename, module_globals=None):
"""Get the lines (as unicode) for a file from the cache.
Update the cache if it doesn't contain an entry for this file already."""
Jörgen Stenarson
Convert filename to bytes in getlines....
r8335 filename = py3compat.cast_bytes(filename, sys.getfilesystemencoding())
Thomas Kluyver
Fixes for producing unicode tracebacks.
r8325 lines = linecache.getlines(filename, module_globals=module_globals)
# The bits we cache ourselves can be unicode.
Thomas Kluyver
Replace references to unicode and basestring
r13353 if (not lines) or isinstance(lines[0], py3compat.unicode_type):
Thomas Kluyver
Fixes for producing unicode tracebacks.
r8325 return lines
readline = openpy._list_readline(lines)
Thomas Kluyver
Fix getting unicode lines in IPython.core.debugger.
r8324 try:
encoding, _ = openpy.detect_encoding(readline)
except SyntaxError:
encoding = 'ascii'
Thomas Kluyver
Fixes for producing unicode tracebacks.
r8325 return [l.decode(encoding, 'replace') for l in lines]
Thomas Kluyver
Fix getting unicode lines in IPython.core.debugger.
r8324
# This is a straight copy of linecache.getline
def getline(filename, lineno, module_globals=None):
lines = getlines(filename, module_globals)
if 1 <= lineno <= len(lines):
return lines[lineno-1]
else:
return ''