Python2.6 xmlrpclib.DateTime can't compare with None

Bug #397294 reported by Shah Japan
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Won't Fix
Low
Unassigned

Bug Description

With python2.6 not able to use xmlrpclib.DateTime anymore, need to use Date only as String.....
here is the traceback....

>>> import xmlrpclib
>>> sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
>>> sock.execute('terp',1,'admin','crm.case','create',{'name':'Hello World!!!','date':xmlrpclib.DateTime()})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python26\lib\xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "c:\python26\lib\xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "c:\python26\lib\xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "c:\python26\lib\xmlrpclib.py", line 1392, in _parse_response
    return u.close()
  File "c:\python26\lib\xmlrpclib.py", line 838, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault Can't compare DateTime and NoneType: 'Traceback (most recent call last):\n File "I:\\WorkSpace\\stable\\server\\bin\\netsvc.py", line 235, in dispatch\n result = LocalService(service_name)(method, *params)\n File "I:\\WorkSpace\\stable\\server\\bin\\netsvc.py", line 74, in __call__\n return getattr(self, method)(*params)\n File "I:\\WorkSpace\\stable\\server\\bin\\service\\web_services.py", line 526, in execute\n res = service.execute(db, uid, object, method, *args)\n File "I:\\WorkSpace\\stable\\server\\bin\\osv\\osv.py", line 59, in wrapper\n return f(self, dbname, *args, **kwargs)\n File "I:\\WorkSpace\\stable\\server\\bin\\osv\\osv.py", line 119, in execute\n res = pool.execute_cr(cr, uid, obj, method, *args, **kw)\n File "I:\\WorkSpace\\stable\\server\\bin\\osv\\osv.py", line 111, in execute_cr\n return getattr(object, method)(cr, uid, *args, **kw)\n File "I:\\WorkSpace\\stable\\addons\\outlook_webmail\\crm\\crm_case.py", line 81, in create\n return super(crm_case_extended,self).create(cr, user, vals, context=context)\n File "I:\\WorkSpace\\stable\\addons\\crm\\crm.py", line 596, in create\n res = super(crm_case, self).create(cr, uid, *args, **argv)\n File "I:\\WorkSpace\\stable\\server\\bin\\osv\\orm.py", line 2421, in create\n upd2.append(self._columns[field]._symbol_set[1](vals[field]))\n File "I:\\WorkSpace\\stable\\server\\bin\\osv\\fields.py", line 46, in _symbol_set\n if symb == None or symb == False:\n File "c:\\python26\\lib\\xmlrpclib.py", line 419, in __eq__\n s, o = self.make_comparable(other)\n File "c:\\python26\\lib\\xmlrpclib.py", line 399, in make_comparable\n (self.__class__.__name__, otype))\nTypeError: Can\'t compare DateTime and NoneType\n'>
>>>

[2009-07-09 11:34:10,217] ERROR:web-services:[01]: Traceback (most recent call last):
[2009-07-09 11:34:10,217] ERROR:web-services:[02]: File "I:\WorkSpace\stable\server\bin\osv\osv.py", line 59, in wrapper
[2009-07-09 11:34:10,217] ERROR:web-services:[03]: return f(self, dbname, *args, **kwargs)
[2009-07-09 11:34:10,217] ERROR:web-services:[04]: File "I:\WorkSpace\stable\server\bin\osv\osv.py", line 119, in execute
[2009-07-09 11:34:10,217] ERROR:web-services:[05]: res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
[2009-07-09 11:34:10,217] ERROR:web-services:[06]: File "I:\WorkSpace\stable\server\bin\osv\osv.py", line 111, in execute_cr
[2009-07-09 11:34:10,217] ERROR:web-services:[07]: return getattr(object, method)(cr, uid, *args, **kw)
[2009-07-09 11:34:10,217] ERROR:web-services:[08]: File "I:\WorkSpace\stable\addons\outlook_webmail\crm\crm_case.py", line 81, in create
[2009-07-09 11:34:10,217] ERROR:web-services:[09]: return super(crm_case_extended,self).create(cr, user, vals, context=context)
[2009-07-09 11:34:10,217] ERROR:web-services:[10]: File "I:\WorkSpace\stable\addons\crm\crm.py", line 596, in create
[2009-07-09 11:34:10,217] ERROR:web-services:[11]: res = super(crm_case, self).create(cr, uid, *args, **argv)
[2009-07-09 11:34:10,217] ERROR:web-services:[12]: File "I:\WorkSpace\stable\server\bin\osv\orm.py", line 2421, in create
[2009-07-09 11:34:10,217] ERROR:web-services:[13]: upd2.append(self._columns[field]._symbol_set[1](vals[field]))
[2009-07-09 11:34:10,217] ERROR:web-services:[14]: File "I:\WorkSpace\stable\server\bin\osv\fields.py", line 46, in _symbol_set
[2009-07-09 11:34:10,217] ERROR:web-services:[15]: if symb == None or symb == False:
[2009-07-09 11:34:10,217] ERROR:web-services:[16]: File "c:\python26\lib\xmlrpclib.py", line 419, in __eq__
[2009-07-09 11:34:10,217] ERROR:web-services:[17]: s, o = self.make_comparable(other)
[2009-07-09 11:34:10,217] ERROR:web-services:[18]: File "c:\python26\lib\xmlrpclib.py", line 399, in make_comparable
[2009-07-09 11:34:10,217] ERROR:web-services:[19]: (self.__class__.__name__, otype))
[2009-07-09 11:34:10,217] ERROR:web-services:[20]: TypeError: Can't compare DateTime and NoneType

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

but the bug here is in your call to the server, not in Open ERP ?

Revision history for this message
Shah Japan (jsh.axelor) wrote :

yes but in python2.5 everything is working with xmlrpclib.DateTime, but when we use python2.6 it says can't compare DateTime with None,

so we have to use DateTime as string only, xmlrpclib.DateTime will not be supported by OpenERP ?

Revision history for this message
Parthiv Patel (parthiv-patel-deactivatedaccount) wrote :

Even with python2.5 date is compared with False and causes the following error !

[2009-08-20 13:08:43,433] ERROR:web-services:[45]: File "/home/abc/abc/server/bin/osv/orm.py", line 2584, in create
[2009-08-20 13:08:43,434] ERROR:web-services:[46]: upd2.append(self._columns[field]._symbol_set[1](vals[field]))
[2009-08-20 13:08:43,434] ERROR:web-services:[47]: File "/home/abc/abc/server/bin/osv/fields.py", line 46, in _symbol_set
[2009-08-20 13:08:43,434] ERROR:web-services:[48]: if symb == None or symb == False:
[2009-08-20 13:08:43,434] ERROR:web-services:[49]: Error: cannot convert value to a time value

value of symb is <mx.DateTime.DateTime object for '2038-01-20 00:00:00.00' at 8719090>

Shah Japan (jsh.axelor)
Changed in openobject-server:
status: New → Confirmed
Changed in openobject-server:
assignee: nobody → Anup (Open ERP) (ach-openerp)
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This is an upstream error from Python, and is not supported by OpenERP. Please report it upstream to the xmlrpclib developers.
Using strings should work fine, and is what OpenERP clients do by default.

If in doubt about the timezone and dateformat to use:
- For the formats, there are constants in the code, e.g. in server/tools
- For the timezone, keep in mind that all timestamps sent to the server must be expressed in the _server_'s timezone, not the timezone of the client. You can ask the server for its timezone by calling the common/timezone_get RPC method

Thanks!

Changed in openobject-server:
assignee: Anup (OpenERP) (ach-openerp) → nobody
importance: Undecided → Low
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.