XMLRPC can't handle non-strings as keys
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
I recently came across the problem described at http://
When accessing these functions through XMLRPC (at least using python's xmlrpclib), the use of integer ids as keys causes an error. For example, the following code snippet (using get_product_
stocknum = sock.execute(db, uid, pass, 'product.product', 'get_product_
Results in the traceback:
File "/usr/lib/
return self.__
File "/usr/lib/
verbose=
File "/usr/lib/
return self._parse_
File "/usr/lib/
return u.close()
File "/usr/lib/
raise Fault(*
xmlrpclib.Fault: <Fault 1: "<type 'exceptions.
I'm not very experienced with XMLRPC, so apologies if this is a problem specific to python's xmlrpclib, or my use of it.
But if not, then perhaps a solution similar to the last patch proposed on the above forum post - ensuring dict keys are run through str() - would be wise.
This is with OpenERP 5 rev. 2159.
On Monday 13 December 2010, you wrote: www.openerp. com/forum/ post22813. html - namely that several
> Public bug reported:
>
> I recently came across the problem described at
> http://
> functions return dictionaries of the format {id1: result1, id2:
> result2}.
> I'm not very experienced with XMLRPC, so apologies if this is a problem
> specific to python's xmlrpclib, or my use of it.
>
That's a limitation of the XML-RPC library. We can't really do much about it,
as we don't want to redefine the protocols.
This is the reason, too, that we craft the result of some ORM functions, so
that they fit this limitation