@ -6,7 +6,7 @@ from jupyter_server.extension.handler import (
ExtensionHandlerMixin ,
ExtensionHandlerJinjaMixin ,
)
from jupyter_server . utils import url_path_join as ujoin , url_escape
from jupyter_server . utils import url_path_join as ujoin
from jupyterlab . commands import get_app_dir , get_user_settings_dir , get_workspaces_dir
from jupyterlab_server import LabServerApp
from jupyterlab_server . config import get_page_config , recursive_update , LabConfig
@ -105,8 +105,9 @@ class ClassicApp(NBClassicConfigShimMixin, LabServerApp):
app_name = " JupyterLab Classic "
description = " JupyterLab Classic - A JupyterLab Distribution with the Classic Notebook look and feel "
app_version = version
extension_url = " /classic /tree "
extension_url = " /classic "
default_url = " /classic/tree "
file_url_prefix = " /classic/notebooks "
load_other_extensions = True
app_dir = app_dir
app_settings_dir = pjoin ( app_dir , " settings " )
@ -114,8 +115,16 @@ class ClassicApp(NBClassicConfigShimMixin, LabServerApp):
themes_dir = pjoin ( app_dir , " themes " )
user_settings_dir = get_user_settings_dir ( )
workspaces_dir = get_workspaces_dir ( )
subcommands = { }
def initialize_handlers ( self ) :
self . handlers . append (
(
rf " / { self . file_url_prefix } /((?!.* \ .ipynb($| \ ?)).*) " ,
web . RedirectHandler ,
{ " url " : " /classic/edit/ {0} " }
)
)
self . handlers . append ( ( " /classic/tree(.*) " , ClassicTreeHandler ) )
self . handlers . append ( ( " /classic/notebooks(.*) " , ClassicNotebookHandler ) )
self . handlers . append ( ( " /classic/edit(.*) " , ClassicFileHandler ) )
@ -129,6 +138,13 @@ class ClassicApp(NBClassicConfigShimMixin, LabServerApp):
self . static_paths = [ self . static_dir ]
self . template_paths = [ self . templates_dir ]
def initialize_settings ( self ) :
super ( ) . initialize_settings ( )
def initialize ( self , argv = None ) :
""" Subclass because the ExtensionApp.initialize() method does not take arguments """
super ( ) . initialize ( )
main = launch_new_instance = ClassicApp . launch_instance