Bug #11088
sérialisation d'un schéma vs date option
Début:
27 mai 2016
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
Dans un formulaire qui a un champ option (tiré de workflow) avec des dates, ça donne ça lors de la sérialisation en dictionnaire :
'options': {'date_fin_paiement': time.struct_time(tm_year=2016, tm_mon=6, tm_mday=14, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=166, tm_isdst=-1), 'date_fin': time.struct_time(tm_year=2016, tm_mon=6, tm_mday=9, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=161, tm_isdst=-1),
et rapidement derrière,
Exception: type = '<type 'exceptions.TypeError'>', value = 'time.struct_time(tm_year=2016, tm_mon=6, tm_mday=14, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1 , tm_yday=166, tm_isdst=-1) is not JSON serializable'
Fichiers
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a presque 8 ans
- Fichier 0001-formdef-use-custom-json-encoder-for-schema-export-11.patch 0001-formdef-use-custom-json-encoder-for-schema-export-11.patch ajouté
- Statut changé de Nouveau à En cours
- Patch proposed changé de Non à Oui
Mis à jour par Thomas Noël il y a presque 8 ans
Ack.
Juste pour ma gouverne :
json.loads(formdef.export_to_json())['options']['foo'].startswith('2016-04')c'est lié au soucis de timezone ?
Mis à jour par Frédéric Péters il y a presque 8 ans
Thomas Noël a écrit :
Juste pour ma gouverne :
[...] c'est lié au soucis de timezone ?
Oui, c'est en attendant #9876.
Mis à jour par Frédéric Péters il y a presque 8 ans
- Statut changé de En cours à Résolu (à déployer)
commit 88380bc58e997c4bd63cc251401c7da565756244 Author: Frédéric Péters <fpeters@entrouvert.com> Date: Fri Jun 17 20:14:26 2016 +0200 formdef: use custom json encoder for schema export (#11088)
formdef: use custom json encoder for schema export (#11088)