Closed Bug 1697587 Opened 4 years ago Closed 4 years ago

Add "Concordance Search" MachinerySource on backend

Categories

(Webtools Graveyard :: Pontoon, defect, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mathjazz, Assigned: mathjazz)

Details

Attachments

(1 file)

We set MachinerySource for translations copied from Concordance search to concordance-search on frontend and in the DB.

But when we render such translation in the History panel, validation of the concordance-search value fails:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/app/pontoon/base/utils.py", line 124, in wrap
    return f(request, *args, **kwargs)
  File "/app/pontoon/base/views.py", line 414, in get_translation_history
    "machinery_sources": t.machinery_sources_values,
  File "/app/pontoon/base/models.py", line 3119, in machinery_sources_values
    result = [
  File "/app/pontoon/base/models.py", line 3120, in <listcomp>
    self.MachinerySource(source).label for source in self.machinery_sources
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 'concordance-search' is not a valid MachinerySource

I'm bothered about the tight coupling between frontend and backend here.

What happens if we drop a machinery source? How would a 3rd party install hook up a different machinery into the data model?

Those were thoughts I had after I got troubled by how hard it is to test this mapping.

Maybe the choice for models.TextChoices isnt't great in this particular case?

All good points. I don't know if they fit into bug 1657082, or should we file a separate one?

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

I think a separate bug would be better.

Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: