Removing of migrated revocations fails #328

Closed
opened 1 year ago by mpeltriaux · 2 comments
Owner

Bug

ValueError at /intervention/abc/revocation/xyz/remove
The 'file' attribute has no file associated with it.

...

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/konova/konova/decorators.py", line 172, in wrap
    return function(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/konova/konova/decorators.py", line 80, in wrap
    return function(request, *args, **kwargs)
  File "/konova/konova/decorators.py", line 147, in wrap
    return function(request, *args, **kwargs)
  File "/konova/intervention/views/revocation.py", line 116, in remove_revocation_view
    redirect_url=reverse("intervention:detail", args=(intervention.id,)) + "#related_data"
  File "/konova/konova/forms/modals/base_form.py", line 54, in process_request
    self.save()
  File "/konova/intervention/forms/modals/revocation.py", line 110, in save
    self.instance.remove_revocation(self)
  File "/konova/intervention/models/intervention.py", line 276, in remove_revocation
    revocation.delete()
  File "/konova/intervention/models/revocation.py", line 29, in delete
    self.document.delete(*args, **kwargs)
  File "/konova/intervention/models/revocation.py", line 83, in delete
    folder_path = self.file.path.split("/")
  File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/files.py", line 56, in path
    self._require_file()
  File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/files.py", line 38, in _require_file
    raise ValueError("The '%s' attribute has no file associated with it." % self.field.name)

# Bug ``` ValueError at /intervention/abc/revocation/xyz/remove The 'file' attribute has no file associated with it. ... Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/konova/konova/decorators.py", line 172, in wrap return function(request, *args, **kwargs) File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view return view_func(request, *args, **kwargs) File "/konova/konova/decorators.py", line 80, in wrap return function(request, *args, **kwargs) File "/konova/konova/decorators.py", line 147, in wrap return function(request, *args, **kwargs) File "/konova/intervention/views/revocation.py", line 116, in remove_revocation_view redirect_url=reverse("intervention:detail", args=(intervention.id,)) + "#related_data" File "/konova/konova/forms/modals/base_form.py", line 54, in process_request self.save() File "/konova/intervention/forms/modals/revocation.py", line 110, in save self.instance.remove_revocation(self) File "/konova/intervention/models/intervention.py", line 276, in remove_revocation revocation.delete() File "/konova/intervention/models/revocation.py", line 29, in delete self.document.delete(*args, **kwargs) File "/konova/intervention/models/revocation.py", line 83, in delete folder_path = self.file.path.split("/") File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/files.py", line 56, in path self._require_file() File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/files.py", line 38, in _require_file raise ValueError("The '%s' attribute has no file associated with it." % self.field.name) ```
mpeltriaux added the
bug
label 1 year ago
mpeltriaux self-assigned this 1 year ago
Poster
Owner

On migration RevocationDocument entries have been added. Since there have not been any revocation documents in the past, the file attribute is empty, resulting in a ValueError.

On migration `RevocationDocument` entries have been added. Since there have not been any revocation documents in the past, the `file` attribute is empty, resulting in a `ValueError`.
mpeltriaux referenced this issue from a commit 1 year ago
Poster
Owner

Merged in #329

# Merged in #329
mpeltriaux closed this issue 1 year ago
Sign in to join this conversation.
Loading…
There is no content yet.