Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use VoilaHandler for .ipynb files #191

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions voila/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@

from jupyter_server.services.kernels.kernelmanager import MappingKernelManager
from jupyter_server.services.kernels.handlers import KernelHandler, ZMQChannelsHandler
from jupyter_server.base.handlers import path_regex
from jupyter_server.services.contents.largefilemanager import LargeFileManager
from jupyter_server.base.handlers import path_regex
from jupyter_server.utils import url_path_join
from jupyter_server.services.config import ConfigManager
from jupyter_server.base.handlers import FileFindHandler
from jupyter_core.paths import jupyter_config_path, jupyter_path
from ipython_genutils.py3compat import getcwd

from .paths import ROOT, STATIC_ROOT, collect_template_paths
from .paths import ROOT, STATIC_ROOT, collect_template_paths, notebook_path_regex
from .handler import VoilaHandler
from .treehandler import VoilaTreeHandler
from ._version import __version__
Expand Down Expand Up @@ -422,7 +422,7 @@ def start(self):
handlers.extend([
(self.server_url, VoilaTreeHandler),
(url_path_join(self.server_url, r'/voila/tree' + path_regex), VoilaTreeHandler),
(url_path_join(self.server_url, r'/voila/render' + path_regex), VoilaHandler,
(url_path_join(self.server_url, r'/voila/render' + notebook_path_regex), VoilaHandler,
{
'nbconvert_template_paths': self.nbconvert_template_paths,
'config': self.config,
Expand Down
2 changes: 2 additions & 0 deletions voila/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# if the directory above us contains the following paths, it means we are installed in dev mode (pip install -e .)
DEV_MODE = os.path.exists(os.path.join(ROOT, '../setup.py')) and os.path.exists(os.path.join(ROOT, '../share'))

notebook_path_regex = r'(.*\.ipynb)'


def collect_template_paths(
nbconvert_template_paths,
Expand Down
4 changes: 2 additions & 2 deletions voila/server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from jupyter_server.base.handlers import path_regex
from jupyter_server.base.handlers import FileFindHandler

from .paths import ROOT, STATIC_ROOT, collect_template_paths, jupyter_path
from .paths import ROOT, STATIC_ROOT, collect_template_paths, jupyter_path, notebook_path_regex
from .handler import VoilaHandler
from .treehandler import VoilaTreeHandler
from .static_file_handler import MultiStaticFileHandler
Expand Down Expand Up @@ -54,7 +54,7 @@ def load_jupyter_server_extension(server_app):
else:
nbextensions_path = jupyter_path('nbextensions')
web_app.add_handlers(host_pattern, [
(url_path_join(base_url, '/voila/render' + path_regex), VoilaHandler, {
(url_path_join(base_url, '/voila/render' + notebook_path_regex), VoilaHandler, {
'config': server_app.config,
'nbconvert_template_paths': nbconvert_template_paths,
'voila_configuration': voila_configuration
Expand Down