Project

General

Profile

Bug #66924

objet non sérialisable en JSON

Added by Benjamin Dauvergne 7 months ago. Updated 7 months ago.

Status:
Information nécessaire
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04 July 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

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.

History

#1

Updated by Frédéric Péters 7 months ago

  • Status changed from Nouveau to Information nécessaire

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

Also available in: Atom PDF