This question has been flagged
2 Replies
51976 Views

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
Discard
Best Answer

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
Discard
Author

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)

Author

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.

Author

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

Author

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.

Author

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)

Best Answer

Hi,

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

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

Avatar
Discard
Author

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?"