Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
57507 Visualizzazioni

I have a hit the exception ...

 TypeError: cannot marshal None unless allow_none is enabled

... several times already when working with XMLRPC.

While it gives me the clue that I must not allow None types in my data sets, it would really help to enable allow_none, when this occurs, in order to pinpoint which field is null.

How do I enable allow_none on XMLRPC?

Avatar
Abbandona
Risposta migliore

Hi Martin,

OpenERP's XMLRPC protocol doesn't allow the None values to pass to the client. So you need to replace those None values by False. To identify which values are passed as None just start your server with --log-level='debug_rpc_answer' and check the last rpc_answer sent to the client. Or add "allow_none=True" to all xmlrpc.ServerProxy calls in rpc.py in the GTK client.

Thanks,

Avatar
Abbandona
Autore

Naresh, I was unaware of the --log-level='debug_rpc_answer' switch. That's a hot tip. Thank you! I think I prefer your other suggestion, but it is not clear to me. I access the RPC from my own program by means of https://pypi.python.org/pypi/openerp-client-lib. Do I need to find xmlrpc.ServerProxy calls in it's source code? Doesn't V7 make the GTK client obsolete?

Hi Martin, Yes the GTK client is obsolete since V7. And as you are using the openerp-client-lib you will need to change the source code http://bazaar.launchpad.net/~niv-openerp/openerp-client-lib/trunk/view/head:/openerplib/main.py at line 82 you can replace " service = xmlrpclib.ServerProxy(url)" by service = xmlrpclib.ServerProxy(url,allow_none=True)

Autore

So that's a server side setting that my XMLRPC client cannot request or set itself. Is that correct? Sorry to be thick. It's a conceptual thing and I want to be sure we're not talking at cross-purposes. (I come from the Java world and I'm fairly new to OpenERP and Python.)

your client can pass the parameter while making the xmlrpclib.ServerProxy object to communicate.

Autore

I'll let you know how I get on as soon as I try it. Thank's so much.

Autore

You're my hero! (but I have not seen how my "... client can pass the parameter while making the xmlrpclib.ServerProxy object to communicate." How do I do that?)

Hi Martin, If you are using openerp-client-lib as you told in your first comment then I have already answer how to pass the parameter in my 2nd comment along with line no to make the changes.

Autore

Naresh. Sorry. You are quite right. I had already worked too many hours when I wrote that. I am indeed using openerp-client-lib, and your solution worked exactly as you said. My addled brain was seeing the library as a service I am using, and I was wondering if there exists a way to tell it to enable and disable None 'on-the-fly'. Perhaps subclassing? This is not at all urgent, however.

Thank you very much Mr. Naresh Soni (nch)

Risposta migliore

Hi,

Can you please check that Is there missing value in required fields ?

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

Avatar
Abbandona
Autore

I'm almost certain there is. But, which field? If I could use allow_none, then I could see. So . . . "How do I enable allow_none on XMLRPC?"

Post correlati Risposte Visualizzazioni Attività
1
ott 25
5161
0
dic 24
10119
3
set 24
22493
5
dic 24
54325
4
lug 24
11355