Projet

Général

Profil

Bug #66924

objet non sérialisable en JSON

Ajouté par Benjamin Dauvergne il y a presque 2 ans. Mis à jour il y a 4 mois.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
04 juillet 2022
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non

Description

https://sentry.entrouvert.org/entrouvert/gplexpert/issues/61798/

TypeError: Object of type LazyFormData is not JSON serializable
  File "wcs/compat.py", line 56, in get
    context = self.get_context_data(**kwargs)
  File "wcs/views.py", line 39, in get_context_data
    body = get_publisher().try_publish(get_request())
  File "quixote/publish.py", line 241, in try_publish
    output = self.root_directory._q_traverse(components)
  File "modules/root.py", line 293, in _q_traverse
    output = Directory._q_traverse(self, path)
  File "quixote/directory.py", line 88, in _q_traverse
    return obj._q_traverse(path)
  File "wcs/backoffice/root.py", line 83, in _q_traverse
    return super()._q_traverse(path)
  File "quixote/directory.py", line 116, in _q_traverse
    return super(AccessControlled, self)._q_traverse(path)
  File "quixote/directory.py", line 88, in _q_traverse
    return obj._q_traverse(path)
  File "wcs/backoffice/management.py", line 162, in _q_traverse
    return super()._q_traverse(path)
  File "quixote/directory.py", line 88, in _q_traverse
    return obj._q_traverse(path)
  File "quixote/directory.py", line 88, in _q_traverse
    return obj._q_traverse(path)
  File "wcs/forms/common.py", line 908, in _q_traverse
    return super()._q_traverse(path)
  File "quixote/directory.py", line 92, in _q_traverse
    return obj()
  File "wcs/backoffice/management.py", line 2985, in _q_index
    return self.status()
  File "wcs/forms/common.py", line 587, in status
    response = self.check_submitted_form(form)
  File "wcs/forms/common.py", line 385, in check_submitted_form
    url = self.submit(form)
  File "wcs/forms/common.py", line 676, in submit
    next_url = self.filled.handle_workflow_form(user, form)
  File "wcs/formdata.py", line 740, in handle_workflow_form
    return wf_status.handle_form(form, self, user)
  File "wcs/workflows.py", line 1934, in handle_form
    url = filled.perform_workflow(event='workflow-form-submit')
  File "wcs/formdata.py", line 651, in perform_workflow
    url = perform_items(wf_status.items, self, event=event)
  File "wcs/workflows.py", line 94, in perform_items
    url = item.perform(formdata) or url
  File "wcs/wf/wscall.py", line 415, in perform
    response, status, data = call_webservice(
  File "wcs/wscalls.py", line 158, in call_webservice
    payload = json.dumps(payload, cls=JSONEncoder)
  File "__init__.py", line 234, in dumps
    return cls(
  File "wcs/qommon/misc.py", line 606, in encode
    return super().encode(preprocess_struct_time(o))
  File "json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "wcs/qommon/misc.py", line 644, in default
    return json.JSONEncoder.default(self, o)
  File "json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '

Je ne me dit qu'on devrait lever une erreur claire (indiquant la clé et la valeur dans le record_error, lien vers le StatusItem, etc..), ne pas faire l'appel et jumper vers un statut d'erreur plutôt que de tracer.


Demandes liées

Lié à w.c.s. - Bug #74150: wscall: form_attachments dans post_data (TypeError: Object of type AttachmentsSubstitutionProxy is not JSON serializable)Fermé03 février 2023

Actions

Historique

#1

Mis à jour par Frédéric Péters il y a presque 2 ans

  • Statut changé de Nouveau à Information nécessaire

Se renseigner sur ce qu'il est essayé de faire, juger si on doit permettre ça ou pas.

#2

Mis à jour par Frédéric Péters il y a 4 mois

  • Statut changé de Information nécessaire à Fermé

Avec #74150 on a cette situation enregistrée/logguée; à l'admin fonctionnel ensuite de traiter celle-ci.

#3

Mis à jour par Frédéric Péters il y a 4 mois

  • Lié à Bug #74150: wscall: form_attachments dans post_data (TypeError: Object of type AttachmentsSubstitutionProxy is not JSON serializable) ajouté

Formats disponibles : Atom PDF