TypeError: cannot marshal None unless allow_none is enabled

Asked by Francesco Apruzzese

Hi all,

i'm trying to port a module for OpenERP 6.0.x on a 6.1 installation. When i click on create button in the tree views i receive this message:

Server Traceback (most recent call last):
  File "/home/openerp/openerp-6.1/server/openerp/wsgi/core.py", line 80, in xmlrpc_return
    response = xmlrpclib.dumps((result,), methodresponse=1, allow_none=False, encoding=None)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1085, in dumps
    data = m.dumps(params)
  File "/usr/lib/python2.7/xmlrpclib.py", line 632, in dumps
    dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
    f(self, value, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 735, in dump_struct
    dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
    f(self, value, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 658, in dump_nil
    raise TypeError, "cannot marshal None unless allow_none is enabled"
TypeError: cannot marshal None unless allow_none is enabled

If I edit the file /home/openerp/openerp-6.1/server/openerp/wsgi/core.py at line 80 with this line:

response = xmlrpclib.dumps((result,), methodresponse=1, allow_none=True, encoding=None)

all work fine! Why are you choose to set allow_none to False? Is possibile to set it on True? It's a bug?

Thanks, Francesco.

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Francesco Apruzzese (opencode) said :
#1

A module we developed

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#2

Possibly, you might have overridden default_get() or create() and it might either be returning None or there is no return statement.

Thanks.

Revision history for this message
Francesco Apruzzese (opencode) said :
#3

There is not default_get() in my code and create is called when i press "Save" and not when I'm creating a new voice. I doesn't understand where is the problem....

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#4

If you have the issue when you 'Save':

1. For an unsaved record, its create() gets called.
2. For a saved record, its write() gets called.

Hope this helps.
Thanks.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#5

Francesco,

We hope this issue has been resolved, let us know if not yet.

Thanks.

Revision history for this message
Francesco Apruzzese (opencode) said :
#6

The issue has not been resolved.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) said :
#7

Francesco,

I assume the comment#2 should be made sure by you.

Thanks.

Revision history for this message
Pieter J. Kersten (EduSense BV) (pieterj) said :
#8

This issue remains a pain in the...

You could also closely watch the onchange() code in custom views. When parameters in trigger code are unknown or undefined, the clients creates None values by default, which -- while trying to send it to the server -- triggers this bug. Using "onchange( parameter or False )" constructs, you can prevent this.

The permanent solution is to add "allow_none=True" to all xmlrpc.ServerProxy calls in rpc.py in the GTK-client.

Can you help with this problem?

Provide an answer of your own, or ask Francesco Apruzzese for more information if necessary.

To post a message you must log in.