fava icon indicating copy to clipboard operation
fava copied to clipboard

Loading entry context fails for custom directives

Open pwalkr opened this issue 1 year ago • 0 comments

In Journal view, clicking the date to see context of custom directives fails: snip-2024-06-03_87784

It returns Loading entry context failed... in the browser with the full console stack trace below. This broke in v1.21 - if I try on v1.20, I can see the context window for custom options: snip-2024-06-02_87077

Full console stack trace (from 1.27.2 in docker)

Exception on /walker/api/context [GET]
Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/flask/app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
  File "/app/lib/python3.9/site-packages/flask/app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/app/lib/python3.9/site-packages/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/lib/python3.9/site-packages/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/app/lib/python3.9/site-packages/fava/json_api.py", line 159, in _wrapper
    return json_success(res)
  File "/app/lib/python3.9/site-packages/fava/json_api.py", line 66, in json_success
    return jsonify(
  File "/app/lib/python3.9/site-packages/flask/json/__init__.py", line 170, in jsonify
    return current_app.json.response(*args, **kwargs)  # type: ignore[return-value]
  File "/app/lib/python3.9/site-packages/flask/json/provider.py", line 105, in response
    return self._app.response_class(self.dumps(obj), mimetype="application/json")
  File "/app/lib/python3.9/site-packages/fava/core/charts.py", line 86, in dumps
    return dumps(obj)
  File "/app/lib/python3.9/site-packages/fava/core/charts.py", line 69, in dumps
    return simplejson_dumps(
  File "/app/lib/python3.9/site-packages/simplejson/__init__.py", line 381, in dumps
    return cls(
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 300, in encode
    chunks = list(chunks)
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 714, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 668, in _iterencode_dict
    for chunk in chunks:
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 735, in _iterencode
    for chunk in _iterencode(o, _current_indent_level):
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 714, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 668, in _iterencode_dict
    for chunk in chunks:
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 668, in _iterencode_dict
    for chunk in chunks:
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 544, in _iterencode_list
    for chunk in chunks:
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 668, in _iterencode_dict
    for chunk in chunks:
  File "/app/lib/python3.9/site-packages/simplejson/encoder.py", line 734, in _iterencode
    o = _default(o)
  File "/app/lib/python3.9/site-packages/fava/core/charts.py", line 64, in _json_default
    raise TypeError
TypeError

FWIW, I've found the insert-entry options to be great anchor points in the ledger for my accounts, especially since discovering they show up in the filtered journal if you use an unquoted account (with link, as shown in first screenshot)

2021-06-01 custom "fava-option" "insert-entry" Assets:Bank

pwalkr avatar Jun 03 '24 04:06 pwalkr