joshuabach / gnucash-web

A simple, mobile-friendly webinterface for GnuCash
GNU General Public License v3.0
118 stars 18 forks source link

Unexpected value for identifier #47

Closed jayenashar closed 11 months ago

jayenashar commented 1 year ago
[2023-07-30 13:27:25,461] ERROR in app: Exception on /book/accounts/ [GET]
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gnucash_web/auth.py", line 62, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gnucash_web/book.py", line 96, in show_account
    return render_template(
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/templating.py", line 147, in render_template
    return _render(app, template, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask/templating.py", line 130, in _render
    rv = template.render(context)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/usr/lib/python3.11/site-packages/gnucash_web/templates/account.j2", line 2, in top-level template code
    {% from 'forms.j2' import transaction_form %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gnucash_web/templates/base.j2", line 56, in top-level template code
    {% block content required %}{% endblock %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gnucash_web/templates/account.j2", line 40, in block 'content'
    {% for account in account.children | sort(attribute='name') recursive %}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gnucash_web/templates/account.j2", line 57, in template
    {{ account.get_balance() | money(account.commodity) }}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/gnucash_web/utils/jinja.py", line 62, in money
    if numbers.get_currency_symbol(commodity.mnemonic) != commodity.mnemonic:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/babel/numbers.py", line 152, in get_currency_symbol
    return Locale.parse(locale).currency_symbols.get(currency, currency)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/babel/core.py", line 317, in parse
    raise TypeError(f"Unexpected value for identifier: {identifier!r}")
TypeError: Unexpected value for identifier: None
joshuabach commented 1 year ago

Thanks for the report! I will take a look. Can you provide any more information:

That would be great!

jayenashar commented 1 year ago
* which version / git revision you are running,

GnuCash-Web==0.1.0

* configuration,

https://github.com/jayenashar/gnucash-web/blob/main/docker/config.py (with the defaults as i have defined in the py file)

* what you ware doing when this happened?

logging in to gnucash-web

FYI, you can add a template to github which asks for this information.

joshuabach commented 1 year ago

FYI, you can add a template to github which asks for this information.

I know. This project is currently at the stage where I start getting more issue reports / users / PRs than i would have thought and my time management has yet to adapt to this new reality :-) But i will definitly add one.

joshuabach commented 11 months ago

Sorry for getting back so late.

This seems to be an issue within an older version of babel (though I'm not sure if its a bug) when no locale is defined. In my version of babel (2.9.1) I wasn't able to reproduce your behaviour.

Do you know which version of Babel you had when this happened? Can you reproduce it with a more recent version?

jayenashar commented 11 months ago

sorry it looks like i deleted gnucash-web on 18/8. i ended up patching gnucash for what i needed.