Skip to content
  1. Apr 10, 2019
  2. Mar 28, 2019
  3. Mar 16, 2019
  4. Feb 27, 2019
  5. Feb 25, 2019
  6. Feb 24, 2019
  7. Feb 23, 2019
  8. Jan 13, 2019
  9. Jan 06, 2019
  10. Jan 05, 2019
  11. Jan 02, 2019
  12. Dec 30, 2018
  13. Dec 29, 2018
  14. Dec 21, 2018
    • Laurent Bachelier's avatar
      json: Force Decimal as str with simplejson · 81b12994
      Laurent Bachelier authored and Romain Bignon's avatar Romain Bignon committed
      simplejson has an internal way of formatting Decimal so it bypasses our
      formatter.
      Since weboob often deals with money, floats are not a good idea.
      
      Previousl:
      Decimal('1.1') => 1.1 with simplejson+WeboobEncoder
      Decimal('1.1') => '1.1' with json+WeboobEncoder
      Now both give '1.1'.
      
      Under simplejson:
      Using dump(cls=...) always initialize the Encoder class with the
      use_decimal=True argument (unless the argument is provided in the dump
      function, but that requires a lot of alteration in Weboob, and I would
      rather remove simplejson support altogether). So when present, we force it.
      
      Under json:
      There is no use_decimal, so we already go to the default() method of the
      Encoder.
      81b12994