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

unresolvable prev/next meta should lead to warning not crash #137

Open
amir-zeldes opened this issue Feb 12, 2021 · 2 comments
Open

unresolvable prev/next meta should lead to warning not crash #137

amir-zeldes opened this issue Feb 12, 2021 · 2 comments

Comments

@amir-zeldes
Copy link
Member

Ingesting a document with prev/next urn that does not actually exist in another document leads to a successful ingest, but the html vis for the document is not accessible. Better behavior would be:

  • Ignore prev/next (behave like the document just doesn't have that field
  • Output a warning on the cli during ingest
@lgessler
Copy link
Contributor

relevant trace:

  File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/var/www/cts/coptic/coptic/views.py", line 47, in text_view
    visualization = text_object.html_visualizations.get(visualization_format__slug=format)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 399, in get
    self.model._meta.object_name
texts.models.HtmlVisualization.DoesNotExist: HtmlVisualization matching query does not exist.

@lgessler
Copy link
Contributor

Looks like the logic for this is already in place: https://github.com/CopticScriptorium/cts/blob/master/coptic/coptic/views.py#L57L68

This makes sense since it wasn't the fact that the value of next wasn't a valid document_cts_urn which was causing the exception I pasted above. There must be some subtle interaction between having a bad next and that stack trace above. (They seem connected, since fixing the value of next made the issue go away.)

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

No branches or pull requests

2 participants