Project

General

Profile

Bug #11088

sérialisation d'un schéma vs date option

Added by Frédéric Péters almost 7 years ago. Updated over 6 years ago.

Status:
Fermé
Priority:
Normal
Assignee:
-
Target version:
Start date:
27 May 2016
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
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'


Files

Associated revisions

Revision 88380bc5 (diff)
Added by Frédéric Péters over 6 years ago

formdef: use custom json encoder for schema export (#11088)

History

#1

Updated by Frédéric Péters almost 7 years ago

#2

Updated by Thomas Noël over 6 years ago

Ack.

Juste pour ma gouverne :

json.loads(formdef.export_to_json())['options']['foo'].startswith('2016-04')
c'est lié au soucis de timezone ?

#3

Updated by Frédéric Péters over 6 years ago

Thomas Noël a écrit :

Juste pour ma gouverne :
[...] c'est lié au soucis de timezone ?

Oui, c'est en attendant #9876.

#4

Updated by Frédéric Péters over 6 years ago

  • Status changed from En cours to 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)
#5

Updated by Frédéric Péters over 6 years ago

  • Target version set to v1.47
#6

Updated by Frédéric Péters over 6 years ago

  • Status changed from Résolu (à déployer) to Fermé

Also available in: Atom PDF