diff --git a/rhodecode/lib/markup_renderer.py b/rhodecode/lib/markup_renderer.py --- a/rhodecode/lib/markup_renderer.py +++ b/rhodecode/lib/markup_renderer.py @@ -538,20 +538,20 @@ class MarkupRenderer(object): body = '\n'.join([header, css, js, body]) return body, resources - captured_errors = {} - # TODO: In the event of a newer jupyter notebook version, consider increasing the as_version parameter - notebook = nbformat.reads(source, as_version=4, capture_validation_error=captured_errors) - try: - (body, resources) = as_html(notebook) - except AttributeError: - error_messages = '
'.join(str(error) for error in captured_errors.values()) - body = f""" -
-

Invalid Notebook!

-

{error_messages}

-
- """ - return body + captured_errors = {} + # TODO: In the event of a newer jupyter notebook version, consider increasing the as_version parameter + notebook = nbformat.reads(source, as_version=4, capture_validation_error=captured_errors) + if captured_errors: + error_messages = '
'.join(str(error) for error in captured_errors.values()) + body = f""" +
+

Invalid Notebook!

+

{error_messages}

+
+ """ + else: + body, _ = as_html(notebook) + return body class RstTemplateRenderer(object):