leolivier / cousins-matter

A family social network
MIT License
2 stars 0 forks source link

Error 500 when trying to remove the avatar of a member #150

Closed leolivier closed 2 weeks ago

leolivier commented 2 weeks ago

Stack trace:

Internal Server Error: /members/1/edit

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/asgiref/sync.py", line 518, in thread_handler

    raise exc_info[1]

  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/exception.py", line 42, in inner

    response = await get_response(request)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/asgiref/sync.py", line 518, in thread_handler

    raise exc_info[1]

  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 253, in _get_response_async

    response = await wrapped_callback(

               ^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/asgiref/sync.py", line 468, in __call__

    ret = await asyncio.shield(exec_coro)

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run

    result = self.fn(*self.args, **self.kwargs)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/asgiref/sync.py", line 522, in thread_handler

    return func(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch

    return super().dispatch(request, *args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/views/generic/base.py", line 143, in dispatch

    return handler(request, *args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/members/views/views_member.py", line 160, in post

    if form.is_valid():

       ^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/forms/forms.py", line 197, in is_valid

    return self.is_bound and not self.errors

                                 ^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/django/forms/forms.py", line 192, in errors

    self.full_clean()

  File "/usr/local/lib/python3.12/site-packages/django/forms/forms.py", line 325, in full_clean

    self._clean_fields()

  File "/usr/local/lib/python3.12/site-packages/django/forms/forms.py", line 335, in _clean_fields

    value = getattr(self, "clean_%s" % name)()

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/app/members/forms.py", line 46, in clean_avatar

    if len(avatar) > settings.AVATAR_MAX_SIZE:

       ^^^^^^^^^^^

TypeError: object of type 'bool' has no len()