Bug 586 - jinja2.exceptions.UndefinedError
Summary: jinja2.exceptions.UndefinedError
Status: CONFIRMED
Alias: None
Product: EnglishPal
Classification: Unclassified
Component: Bug报告 (show other bugs)
Version: 0.1
Hardware: Macintosh Mac OS
: High critical
Assignee: Hui Lan
URL:
Depends on:
Blocks:
 
Reported: 2025-04-21 19:17 CST by Hui Lan
Modified: 2025-04-22 06:50 CST (History)
0 users

See Also:


Attachments

Description Hui Lan 2025-04-21 19:17:28 CST
After the user signed up, he got the following error while entering his page.

Occurred to branch: EnglishPal-Alpha-snapshot20240618



  File "/Users/kalijerry/Downloads/Lab1/code/EnglishPal-Alpha-snapshot20240618/app/user_service.py", line 155, in userpage
    return render_template('userpage_get.html',
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kalijerry/Downloads/Lab1/.venv/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
    return _render(
           ^^^^^^^^
  File "/Users/kalijerry/Downloads/Lab1/.venv/lib/python3.11/site-packages/flask/templating.py", line 128, in _render
    rv = template.render(context)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kalijerry/Downloads/Lab1/.venv/lib/python3.11/site-packages/jinja2/environment.py", line 1295, in render
    self.environment.handle_exception()
  File "/Users/kalijerry/Downloads/Lab1/.venv/lib/python3.11/site-packages/jinja2/environment.py", line 942, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/Users/kalijerry/Downloads/Lab1/code/EnglishPal-Alpha-snapshot20240618/app/templates/userpage_get.html", line 90, in top-level template code
    <div class="alert alert-success" role="alert">According to your word list, your level is <span class="text-decoration-underline" id="user_level">{{ today_article["user_level"] }}</span>  and we have chosen an article with a difficulty level of <span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span> for you. The Oxford word coverage is <span class="text-decoration-underline" id="ratio">{{ (today_article["ratio"] * 100) | int }}%.</span></div>
jinja2.exceptions.UndefinedError: 'None' has no attribute 'rati



Reported by 章 大 为

Note You need to log in before you can comment on or make changes to this bug.