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

500 errors caused by processor option #345

Open
dale-wahl opened this issue Mar 21, 2023 · 2 comments
Open

500 errors caused by processor option #345

dale-wahl opened this issue Mar 21, 2023 · 2 comments

Comments

@dale-wahl
Copy link
Member

Describe the bug
I have seen this before but cannot recall how it was "fixed". I may have something to do with markdown versions. I see that we have both markdown and markdown2 libraries and swear I removed one (but that could have been in a branch possibly where I was seeing this).

File "/usr/src/app/webtool/templates/result.html", line 7, in block 'body'
    {% include "result-details.html" %}
  File "/usr/src/app/webtool/templates/result-details.html", line 167, in top-level template code
    {% include "processor-details.html" %}
  File "/usr/src/app/webtool/templates/processor-details.html", line 73, in top-level template code
    {% include "components/processor-option.html" %}
  File "/usr/src/app/webtool/templates/components/processor-option.html", line 7, in top-level template code
    {{ option_settings.help|markdown|safe }}
  File "/usr/src/app/webtool/lib/template_filters.py", line 107, in _jinja2_filter_markdown
    val = markdown.markdown(text)
  File "/opt/venv/lib/python3.8/site-packages/markdown/core.py", line 391, in markdown
    return md.convert(text)
  File "/opt/venv/lib/python3.8/site-packages/markdown/core.py", line 252, in convert
    if not source.strip():
jinja2.exceptions.UndefinedError: 'tuple object' has no attribute 'help'

This line seems to be the culprit (or possibly a weird datasource option)
Changing it from {{ option_settings.help|markdown|safe }} to {{ option_settings.help }} causes the problem to go away, but I'm not sure what is happening.

@dale-wahl
Copy link
Member Author

Apparently it isn't the removal of |markdown|safe, but instead it is a possibly random error. Reloading the page can cause the issue to go away (or occur).

@dale-wahl
Copy link
Member Author

dale-wahl commented Mar 21, 2023

{% if option_settings is mapping %}
    {{ option_settings.help|markdown|safe }}
{% endif %}

Don't know why it's happening, but this will stop it from happening...

Immediately before option_settings.help is called, option_settings.type is successful so I'm not convinced option_settings is in fact a tuple until markdown does something to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant