Project

General

Profile

Bug #66995

PicklableUpload renvoyé dans le result de live_process_fields (TypeError: Object of type PicklableUpload is not JSON serializable)

Added by Sentry Io 3 months ago. Updated 3 months ago.

Status:
Fermé
Priority:
Normal
Target version:
-
Start date:
05 July 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:
No

Description

https://sentry.entrouvert.org/entrouvert/publik/issues/62150/

TypeError: Object of type PicklableUpload is not JSON serializable
(14 additional frame(s) were not displayed)
...
  File "wcs/forms/common.py", line 874, in live_process_fields
    return json.dumps({'result': result})
  File "__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  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 "json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '

Files

Associated revisions

Revision 2eef800c (diff)
Added by Frédéric Péters 3 months ago

fields: add check on value computed to prefill items fields (#66995)

History

#1

Updated by Lauréline Guérin 3 months ago

  • Project changed from Suivi des traces to w.c.s.
  • Subject changed from TypeError: Object of type PicklableUpload is not JSON serializable to PicklableUpload renvoyé dans le result de live_process_fields (TypeError: Object of type PicklableUpload is not JSON serializable)

contenu de result:

{
    complement_1: {
        visible: True
    }, 
    ...
    complement_8: {
        content: {
            data: [
                "{'bf05a814f9-1056-4202-85cd-90cb61f0d4d4': 'xxx', 'bf36749360-427b-4e2c-9cff-9d5662eb4444': <PicklableUpload at 7fbb0ab26370: Test.pdf>, 'bf696c68ab-b8f1-4752-8354-d49af8ae588c': <PicklableUpload at 7fbb0ab263a0: xxx.pdf>, 'bf7e143406-8381-4656-8632-33bb0f339196': 'xxx' ...}"]
            }
        }
    }

#2

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

Un champ liste à choix multiple dans un formulaire de workflow,

             <field>
                <label type="str">test</label>
                <type type="str">items</type>
                <required type="bool">True</required>
                <display_locations />
                <items>
                  <item>{{form_var_vehicule1_dt_var_immat}}</item>
                  <item>{{form_var_vehicule2_dt_var_immat}}</item>
                </items>

et ces options auraient donnés des valeurs complexes, pas converties en chaine. (c'est un peu difficile à suivre le workflow a continué à être édité puis ce champ a été supprimé).

#3

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

  • Assignee set to Frédéric Péters

(les gens inventent n'importe quoi)

#4

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

sauf que dans la clé "content" c'est le résultat d'un préremplissage (...)

#5

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

Trouvé ailleurs dans l'historique, ce champ qui était

              <field>
                <label type="str">test</label>
                <type type="str">items</type>
                <required type="bool">True</required>
                <varname type="str">test</varname>
                <display_locations />
                <prefill>
                  <locked>False</locked>
                  <type>string</type>
                  <value>{{form_var_declaration2}}</value>
                </prefill>
                <display_mode type="str">checkboxes</display_mode>
#6

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

Ce n'est pas pile la situation de la trace liée mais ça couvre.

#7

Updated by Lauréline Guérin 3 months ago

  • Status changed from Solution proposée to Solution validée
#8

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

  • Status changed from Solution validée to Résolu (à déployer)
commit 2eef800c831c7ea7cb7be5f5a901f92e95e3b6fc
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Tue Jul 5 12:24:11 2022 +0200

    fields: add check on value computed to prefill items fields (#66995)
#9

Updated by Transition automatique 3 months ago

  • Status changed from Résolu (à déployer) to Solution déployée
#10

Updated by Transition automatique 25 days ago

Automatic expiration

Also available in: Atom PDF