Skip to content

ElementTranscriptionsBulk allows creating transcriptions on elements without zones

Sentry Issue: ARKINDEX-BACKEND-2R

AttributeError: 'NoneType' object has no attribute 'image'
(8 additional frame(s) were not displayed)
...
  File "rest_framework/views.py", line 502, in dispatch
    response = handler(request, *args, **kwargs)
  File "rest_framework/generics.py", line 190, in post
    return self.create(request, *args, **kwargs)
  File "arkindex/documents/api/ml.py", line 179, in create
  File "contextlib.py", line 74, in inner
    return func(*args, **kwds)
  File "arkindex/documents/api/ml.py", line 197, in perform_create

Internal Server Error: /api/v1/element/1104fe49-b787-4fa7-97f4-43cceb607334/transcriptions/bulk/

There is an attempt to access self.element.zone.image to get the image to create all the new zones for elements and transcriptions, but self.element.zone is None. get_queryset is missing a filter to ignore elements without zones.