refried icon indicating copy to clipboard operation
refried copied to clipboard

avail_ext doesn't work

Open ouyanmao opened this issue 1 year ago • 4 comments

How to solve the problem of budget reports not being able to run? Thanks for your helping.

version: python=3.9.18, fava=1.2.5, on fava page,budget reports doesn't work,but the reports "Account" and "Journal" are working fine. show these error message:

Exception on /beancount/extension/AvailExt/ [GET]
Traceback (most recent call last):
  File "/usr/bin/python3/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/bin/python3/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/bin/python3/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/bin/python3/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/bin/python3/site-packages/fava/application.py", line 327, in extension_report
    content = Markup(render_template_string(template, extension=ext))
  File "/usr/bin/python3/site-packages/flask/templating.py", line 163, in render_template_string
    return _render(app, template, context)
  File "/usr/bin/python3/site-packages/flask/templating.py", line 132, in _render
    rv = template.render(context)
  File "/usr/bin/python3/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/bin/python3/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 57, in top-level template code
  File "/home/jeff/refried/refried/extensions/avail_ext/__init__.py", line 35, in make_table
    self.ledger.all_root_account.get('Income'),
AttributeError: 'FavaLedger' object has no attribute 'all_root_account'

ouyanmao avatar Oct 07 '23 07:10 ouyanmao

I'm not sure why you've titled this as a problem with the rebudget plugin? Since this is an issue you're having with AvailExt. In any case, I haven't yet updated AvailExt to work with latest fava, since I haven't really been using that view myself recently.

scauligi avatar Oct 07 '23 18:10 scauligi

I'm not sure why you've titled this as a problem with the rebudget plugin? Since this is an issue you're having with AvailExt. In any case, I haven't yet updated AvailExt to work with latest fava, since I haven't really been using that view myself recently.

Sorry, I wrote the title wrong, it should be that the plugin avail_ext is not working. I know that AvailExt is not compatible with the latest fava, because I am getting errors with all other versions of fava. For example, on fava=1.24 and fava=1.23 the plugin avail_ext works fine with budget report but not with journal with the following error:

Exception on /beancount/extension/JournalExt/ [GET]
Traceback (most recent call last):
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/fava/application.py", line 362, in extension_report
    content = Markup(render_template_string(template, extension=extension))
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/flask/templating.py", line 162, in render_template_string
    template = app.jinja_env.from_string(source)
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/jinja2/environment.py", line 1105, in from_string
    return cls.from_code(self, self.compile(source), gs, None)
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/jinja2/environment.py", line 768, in compile
    self.handle_exception(source=source_hint)
  File "/home/bm/miniconda3/envs/t1/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<unknown>", line 147, in template
jinja2.exceptions.TemplateAssertionError: No filter named 'meta_items'.

Which version of fava are you using now and which version of Python3? I can't really troubleshoot where the problem is. I'd like to copy your version of python3, pip3, and fava to adapt, maybe that will solve the problem. Thanks a lot.

ouyanmao avatar Oct 08 '23 15:10 ouyanmao

Right now avail_ext probably only works with a much older version of fava, since I never got around to updating it when I updated the other two extensions.

Ideally I'd like to update everything to work with latest fava if I need to overhaul these anyway, but turns latest fava (as of 1.26) moved treetables (and lots of other UI) from templates into frontend js via svelte, and right now it's no longer (easily) accessible for extensions to use.

I'd like to be able to use "native" treetables and CSS styles as much as possible instead of recreating them myself; if fava exposes treetables for extensions to use then I'll update everything to use those directly.

scauligi avatar Oct 11 '23 13:10 scauligi

Right now avail_ext probably only works with a much older version of fava, since I never got around to updating it when I updated the other two extensions.

Ideally I'd like to update everything to work with latest fava if I need to overhaul these anyway, but turns latest fava (as of 1.26) moved treetables (and lots of other UI) from templates into frontend js via svelte, and right now it's no longer (easily) accessible for extensions to use.

I'd like to be able to use "native" treetables and CSS styles as much as possible instead of recreating them myself; if fava exposes treetables for extensions to use then I'll update everything to use those directly.

Thank you for your support. Looking forward to your updates.

ouyanmao avatar Oct 12 '23 12:10 ouyanmao