Skip to content

Commit 1417af5

Browse files
krisctlprabhakk-mw
authored andcommitted
Fixes the licensing iframe shown in notebooks to render correctly for environments with non-null jupyter base urls.
1 parent ac49399 commit 1417af5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/jupyter_matlab_kernel/base_kernel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
_MATLAB_STARTUP_TIMEOUT = mwi_settings.get_process_startup_timeout()
3232

3333

34-
def _fetch_jupyter_base_url(parent_pid: str, logger: Logger) -> Optional[str]:
34+
def _fetch_jupyter_base_url(parent_pid: str, logger: Logger) -> str:
3535
"""
3636
Fetches information about the running Jupyter server associated with the MATLAB kernel.
3737
@@ -67,12 +67,12 @@ def _fetch_jupyter_base_url(parent_pid: str, logger: Logger) -> Optional[str]:
6767
# Stop iterating over the server list
6868
return nb_server["base_url"]
6969

70-
# log and return None if the server is not found
70+
# log and return empty string if the server is not found
7171
if not found_nb_server:
7272
logger.debug(
7373
"Jupyter server associated with this MATLAB Kernel not found, might a non-jupyter based MATLAB Kernel"
7474
)
75-
return None
75+
return ""
7676

7777

7878
def _get_parent_pid() -> int:
@@ -442,7 +442,7 @@ def display_output(self, out):
442442
self.send_response(self.iopub_socket, msg_type, response)
443443

444444
async def perform_startup_checks(
445-
self, jupyter_base_url: str = None, matlab_proxy_base_url: str = None
445+
self, jupyter_base_url="", matlab_proxy_base_url=""
446446
):
447447
"""
448448
One time checks triggered during the first execution request. Displays
@@ -497,7 +497,7 @@ async def perform_startup_checks(
497497
"type": "display_data",
498498
"content": {
499499
"data": {
500-
"text/html": f'<iframe src={jupyter_base_url}{matlab_proxy_base_url} width=700 height=600"></iframe>'
500+
"text/html": f'<iframe src={matlab_proxy_base_url} width=700 height=600"></iframe>'
501501
},
502502
"metadata": {},
503503
},

src/jupyter_matlab_kernel/mpm_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def do_shutdown(self, restart):
9393
async def perform_startup_checks(self):
9494
"""Overriding base function to provide a different iframe source"""
9595
await super().perform_startup_checks(
96-
self.jupyter_base_url, f"{self.matlab_proxy_base_url.lstrip('/')}/"
96+
self.jupyter_base_url, f"{self.matlab_proxy_base_url}/"
9797
)
9898

9999
# Helper functions

0 commit comments

Comments
 (0)