コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
56735 ビュー

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?

アバター
破棄
最善の回答

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,

アバター
破棄
著作者

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)

著作者

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.

著作者

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

著作者

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.

著作者

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)

最善の回答

Hi,

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

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

アバター
破棄
著作者

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

関連投稿 返信 ビュー 活動
0
12月 24
9403
3
9月 24
21501
5
12月 24
52794
4
7月 24
10467
7
8月 23
10839