On 30/11/11 20:00 +0800, Sharoon Thomas wrote: > > > > This means that external programs need to be adapted to follow this > > convention. Any way, I think it is better than using float/double for > > Decimal. > > agree, but we should provide a JSONEncoder and Decoder class which other > applications (python) could import from trytond.
It is already the case:
http://hg.tryton.org/trytond/file/4b18342b8575/trytond/protocols/jsonrpc.py#l30
http://hg.tryton.org/trytond/file/4b18342b8575/trytond/protocols/jsonrpc.py#l43
It will be more complicated for XML-RPC as xmlrpclib doesn't provide the
same convenient way.
But anyway, I don't think it is really simplier to import trytond for
such small thing than copy/paste the few lines (they should not change
often).
> >
> > By the way, I think we could also do the same for date.
>
> yes, both datetime.date and datetime.datetime.
> Are you planning to use the isoformat() method on date and datetime ?
In XML-RPC, there is a datetime format. For now, we transformed date
into datetime by appending 00:00:00 to it.
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/
pgp9v1ZKBD6Fc.pgp
Description: PGP signature
