Notes can't be show in grampsweb

Linux Ubuntu 22.04
Package grampsweb · GitHub latest c52bd8342b5d

Some notes (created in desktop gramps) doesn’t open in grampsweb.
I see error 500 in grampsweb UI.
In docker container logs I can see the trace:

gramps.gen.errors.HandleError: Handle e3b6e8acfaf4b465fb3467f1aa1 not found
[2023-10-04 13:34:49 +0000] [20] [ERROR] Error handling request /api/notes/?gramps_id=N0002&locale=ru&profile=all&backlinks=true&extend=all&formats=html&format_options=%7B%22link_format%22%3A%22%2F%7Bobj_class%7D%2F%7Bgramps_id%7D%22%7D
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/local/lib/python3.9/dist-packages/gunicorn/workers/sync.py", line 178, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2193, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/auth.py", line 44, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/flask/views.py", line 109, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/usr/local/lib/python3.9/dist-packages/flask/views.py", line 190, in dispatch_request
    return current_app.ensure_sync(meth)(**kwargs)
  File "/usr/local/lib/python3.9/dist-packages/webargs/core.py", line 649, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/resources/base.py", line 387, in get
    200, [self.full_object(obj, args, locale=locale)], args, total_items=1
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/resources/base.py", line 91, in full_object
    obj = self.object_extend(obj, args, locale=locale)
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/resources/notes.py", line 66, in object_extend
    obj.formatted = {
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/resources/notes.py", line 67, in <dictcomp>
    fmt: self.get_formatted_note(note=obj, fmt=fmt, options=format_options)
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/resources/notes.py", line 84, in get_formatted_note
    return get_note_html(note, link_format=link_format)
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/html.py", line 90, in get_note_html
    html_note_text = styledtext_to_html(
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/html.py", line 155, in styledtext_to_html
    markuptext = backend.add_markup_from_styled(text, s_tags, split="\n")
  File "/usr/lib/python3/dist-packages/gramps/gen/plug/docbackend/docbackend.py", line 284, in add_markup_from_styled
    tag = self.find_tag_by_stag(s_tag)
  File "/usr/lib/python3/dist-packages/gramps/gen/plug/docbackend/docbackend.py", line 221, in find_tag_by_stag
    return self.format_link(s_tag.value)
  File "/usr/lib/python3/dist-packages/gramps/plugins/lib/libhtmlbackend.py", line 305, in format_link
    value = self.build_link(prop, handle, obj_class)
  File "/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/html.py", line 115, in build_link
    obj = func(ref)
  File "/usr/lib/python3/dist-packages/gramps/gen/db/generic.py", line 1297, in get_media_from_handle
    return self._get_from_handle(MEDIA_KEY, Media, handle)
  File "/usr/lib/python3/dist-packages/gramps/gen/db/generic.py", line 1270, in _get_from_handle
    raise HandleError('Handle %s not found' % handle)
gramps.gen.errors.HandleError: Handle e3b6e8acfaf4b465fb3467f1aa1 not found

This can be connected with the note special format (the note contain some font sizes and link) or note hasn’t been synced properly with addon Gramps Web Sync. I tried to change it and resync but this didn’t help. I need help with further troubleshooting. I’d like to figure out if this issue of database syncing or it’s just grampsweb can’t show some special formatting.

1 Like

Hi,

I think the note contains a link to a media object which has been deleted, can you confirm?

If yes, I think Gramps Web API (the Gramps Web backend) shouldn’t throw an error but just omit the link. Can you please open an issue at Issues · gramps-project/gramps-webapi · GitHub?

Thanks.

No, this note contains only text with some font size specifications and also it contains web link to an external wikipedia page.
I created a github issue grampsweb either can't show formatted notes or synchronization issue · Issue #431 · gramps-project/gramps-webapi · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.