Project

General

Profile

Bug #13835

form_receipt_datetime n'est pas jsonifiable

Added by Thomas Noël about 5 years ago. Updated about 5 years ago.

Status:
Fermé
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
03 Nov 2016
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:

Description

Exception:
  type = '<type 'exceptions.TypeError'>', value = 'datetime.datetime(2016, 11, 3, 11, 0, 58) is not JSON serializable'

...

  File "/usr/lib/pymodules/python2.7/extra-wcs-au-quotidien/modules/myspace.py", line 419, in forms
   417             d.update(form.get_substitution_variables(minimal=True))
   418             forms_output.append(d)
>  419         return json.dumps(forms_output)
   420
   421

parce que dans le dictionnaire à jsonifier :

'form_receipt_date': '03/11/2016'
'form_receipt_time': '11:00'
'form_receipt_datetime': ((datetime.datetime(2016, 11, 3, 11, 1, 39),)

Deux choses :
  • c'est un datetime, voir comment jsonifier ça
  • et c'est un tuple, erreur

Files


Related issues

Copied to w.c.s. - Bug #13837: form_receipt_datetime est un tupleFermé03 Nov 2016

Actions

Associated revisions

Revision e138a2fc (diff)
Added by Thomas Noël about 5 years ago

use misc.JSONEncoder on myspace/json/forms (#13835)

History

#1

Updated by Frédéric Péters (absent jusqu’au 12/12) about 5 years ago

  • Project changed from w.c.s. to Au quotidien

Ça devrait utiliser l'encodeur json de qommon.misc.

#2

Updated by Thomas Noël about 5 years ago

  • Copied to Bug #13837: form_receipt_datetime est un tuple added
#3

Updated by Thomas Noël about 5 years ago

#6

Updated by Thomas Noël about 5 years ago

  • Status changed from En cours to Résolu (à déployer)
commit e138a2fc4543fb58257735a26f75ead51d1d3c11
Author: Thomas NOEL <tnoel@entrouvert.com>
Date:   Thu Nov 3 11:26:07 2016 +0100

    use misc.JSONEncoder on myspace/json/forms (#13835)

#7

Updated by Frédéric Péters (absent jusqu’au 12/12) about 5 years ago

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

Also available in: Atom PDF