Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from djuarezg/master
Browse files Browse the repository at this point in the history
Allow to import from either jupyter_server or notebook packages
  • Loading branch information
devstein authored May 16, 2023
2 parents 789403f + 4727348 commit 8be4f39
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hybridcontents/hybridmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
from six import iteritems
from tornado.web import HTTPError

from notebook.services.contents.manager import ContentsManager
# Ref. https://github.com/jupyter/nbdime/blob/c82362344e596efdc4f54c927d90338940e0fa41/nbdime/webapp/nb_server_extension.py#L16-L33
# This allows solving conflicts between the class import from either notebook or jupyter_server
try:
from notebook.services.contents.manager import ContentsManager
except ModuleNotFoundError:
pass

try:
from jupyter_server.services.contents.manager import ContentsManager
except ModuleNotFoundError:
pass

from traitlets import Dict

Expand Down

0 comments on commit 8be4f39

Please sign in to comment.