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

Exception on Load: jinja2.exceptions.UndefinedError: 'url_for_current' is undefined #59

Closed
patbakdev opened this issue Jun 11, 2021 · 3 comments · Fixed by #62
Closed

Comments

@patbakdev
Copy link

Run
cd fava_investor
fava example.beancount

Exception
Exception on /baker/extension/Investor/ [GET]
Traceback (most recent call last):
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/patrick/Sources/Venti/modules/fava/src/fava/application.py", line 352, in extension_report
content = render_template_string(template, extension=extension)
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/templating.py", line 155, in render_template_string
return _render(ctx.app.jinja_env.from_string(source), context, ctx.app)
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/patrick/.local/pyenv/versions/Venti/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "", line 10, in top-level template code
jinja2.exceptions.UndefinedError: 'url_for_current' is undefined

Requirements (Python 3.9.5)
argcomplete==1.12.3
argh==0.26.2
atomicwrites==1.4.0
attrs==21.2.0
Babel==2.9.1
beancount==2.3.4
beancount-import==1.3.3.post1.dev159
beancount-plugins-metadata-spray==0.0.1
beautifulsoup4==4.9.3
bottle==0.12.19
cachetools==4.2.2
certifi==2021.5.30
cffi==1.14.5
chardet==4.0.0
cheroot==8.5.2
click==7.1.2
cryptography==3.4.7
fava==1.20.dev17+ge987bb99
fava-investor==0.2.2.dev19+g0b9da55
Flask==1.1.4
Flask-Babel==1.0.0
google-api-core==1.30.0
google-api-python-client==2.8.0
google-auth==1.31.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.53.0
httplib2==0.19.1
idna==2.10
importlib-metadata==4.5.0
iniconfig==1.1.1
itsdangerous==1.1.0
jaraco.functools==3.3.0
jeepney==0.6.0
Jinja2==2.11.3
joblib==1.0.1
jsonschema==3.2.0
keyring==23.0.1
lxml==4.6.3
markdown2==2.4.0
MarkupSafe==2.0.1
more-itertools==8.8.0
nltk==3.6.2
numpy==1.20.3
ofxclient==2.0.4
ofxhome==0.3.3
ofxparse==0.21
packaging==20.9
pip==21.1.2
pluggy==0.13.1
ply==3.11
protobuf==3.17.3
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pyparsing==2.4.7
pyrsistent==0.17.3
pytest==6.2.4
python-dateutil==2.8.1
python-magic==0.4.24
pytz==2021.1
regex==2021.4.4
requests==2.25.1
rsa==4.7.2
scikit-learn==0.24.2
scipy==1.6.3
SecretStorage==3.3.1
setuptools==56.0.0
simplejson==3.17.2
six==1.16.0
soupsieve==2.2.1
tabulate==0.8.9
threadpoolctl==2.1.0
toml==0.10.2
tornado==6.1
tqdm==4.61.0
uritemplate==3.0.1
urllib3==1.26.5
venti==0.0
watchdog==2.1.2
Werkzeug==1.0.1
zipp==3.4.1

@jonoharms
Copy link

I was having the same issue. I found that in application.py the url_for_current function was renamed and modified to url_for_source in commit 99e9900 of fava. See the diff here. beancount/fava@9e99001#diff-34e70ccbc25aaa9a79d126c4b4b93bc93948cb6dfe9bd5b5978d8a1ea4227205.

After reverting to fava 1.19, it works.

@patbakdev
Copy link
Author

Thanks @jonoharms! That work-around works for me.

aclindsa added a commit to aclindsa/fava_investor that referenced this issue Jul 26, 2021
@aclindsa
Copy link
Contributor

I found that in application.py the url_for_current function was renamed and modified to url_for_source in commit 99e9900 of fava.

I believe this is incorrect. As I posted here, url_for_source is a different function entirely and using it instead of url_for_current does not result in the correct behavior. This doesn't change the fact that for now reverting to 1.19 should resolve the issue, though.

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