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

fix: the default title in the template is always Notebook #501

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
2 changes: 1 addition & 1 deletion tests/app/execute_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_hello_world(http_client, base_url):
assert response.code == 200
html_text = response.body.decode('utf-8')
assert 'Hi Voila' in html_text
assert 'print' not in html_text, 'by default the source code should be stripped'
assert 'print(' not in html_text, 'by default the source code should be stripped'
assert 'test_template.css' not in html_text, "test_template should not be the default"


Expand Down
2 changes: 1 addition & 1 deletion tests/server/execute_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ def test_hello_world(http_client, print_notebook_url):
assert response.code == 200
html_text = response.body.decode('utf-8')
assert 'Hi Voila' in html_text
assert 'print' not in html_text, 'by default the source code should be stripped'
assert 'print(' not in html_text, 'by default the source code should be stripped'
assert 'test_template.css' not in html_text, "test_template should not be the default"
8 changes: 7 additions & 1 deletion voila/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ async def get(self, path=None):
return
self.cwd = os.path.dirname(notebook_path)

path, basename = os.path.split(notebook_path)
notebook_name = os.path.splitext(basename)[0]

# render notebook to html
resources = {
'base_url': self.base_url,
'nbextensions': nbextensions,
'theme': self.voila_configuration.theme
'theme': self.voila_configuration.theme,
'metadata': {
'name': notebook_name
}
}

# include potential extra resources
Expand Down