← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 816799] [NEW] Chinese date format crashes web client

 

Public bug reported:

When using standard Chinese format 
%Y年%m月%d日
%H时%M分%S秒

Web client crashes when trying to display the sales dashboard :
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
....
self = DateTime, self.text = None, self.get_text = <bound method DateTime.get_text of DateTime>
 /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.2-py2.6.egg/addons/openerp/widgets/listgrid.py in get_text(self=DateTime)
  575 
  576     def get_text(self):
  577         return format.format_datetime(self.value, kind=self.attrs.get('type', 'datetime'))
  578 
  579     def get_sortable_text(self):
global format = <module 'openobject.i18n.format' from '/usr/loca..._web-6.0.2-py2.6.egg/openobject/i18n/format.pyc'>, format.format_datetime = <function format_datetime>, self = DateTime, self.value = u'2011-07-27', kind undefined, self.attrs = {'name': u'date_order', 'readonly': True, 'required': True, 'select': True, 'selectable': True, 'states': {'draft': [(u'readonly', False)]}, 'string': u'Ordered Date', 'type': u'date', 'value': u'2011-07-27', 'views': {}}, self.attrs.get = <built-in method get of dict object>
 /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.2-py2.6.egg/openobject/i18n/format.py in format_datetime(value=time.struct_time(tm_year=2011, tm_mon=7, tm_mday...0, tm_sec=0, tm_wday=2, tm_yday=208, tm_isdst=-1), kind=u'date', as_timetuple=False)
  158         return value
  159 
  160     return time.strftime(local_format, value)
  161 
  162 def parse_datetime(value, kind="datetime", as_timetuple=False):
global time = <module 'time' (built-in)>, time.strftime = <built-in function strftime>, local_format = u'%Y\u5e74%m\u6708%d\u65e5', value = time.struct_time(tm_year=2011, tm_mon=7, tm_mday...0, tm_sec=0, tm_wday=2, tm_yday=208, tm_isdst=-1)
<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\u5e74' in position 2: ordinal not in range(128) 
      args = ('ascii', u'%Y\u5e74%m\u6708%d\u65e5', 2, 3, 'ordinal not in range(128)') 
      encoding = 'ascii' 
      end = 3 
      message = '' 
      object = u'%Y\u5e74%m\u6708%d\u65e5' 
      reason = 'ordinal not in range(128)' 
      

Changing in Languages the default for date format and time format to
%Y/%m/%d and %H:%M:%S solves the problem.

** Affects: openobject-client-web
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/816799

Title:
  Chinese date format crashes web client

Status in OpenERP Web Client:
  New

Bug description:
  When using standard Chinese format 
  %Y年%m月%d日
  %H时%M分%S秒

  Web client crashes when trying to display the sales dashboard :
  A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
  ....
  self = DateTime, self.text = None, self.get_text = <bound method DateTime.get_text of DateTime>
   /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.2-py2.6.egg/addons/openerp/widgets/listgrid.py in get_text(self=DateTime)
    575 
    576     def get_text(self):
    577         return format.format_datetime(self.value, kind=self.attrs.get('type', 'datetime'))
    578 
    579     def get_sortable_text(self):
  global format = <module 'openobject.i18n.format' from '/usr/loca..._web-6.0.2-py2.6.egg/openobject/i18n/format.pyc'>, format.format_datetime = <function format_datetime>, self = DateTime, self.value = u'2011-07-27', kind undefined, self.attrs = {'name': u'date_order', 'readonly': True, 'required': True, 'select': True, 'selectable': True, 'states': {'draft': [(u'readonly', False)]}, 'string': u'Ordered Date', 'type': u'date', 'value': u'2011-07-27', 'views': {}}, self.attrs.get = <built-in method get of dict object>
   /usr/local/lib/python2.6/dist-packages/openerp_web-6.0.2-py2.6.egg/openobject/i18n/format.py in format_datetime(value=time.struct_time(tm_year=2011, tm_mon=7, tm_mday...0, tm_sec=0, tm_wday=2, tm_yday=208, tm_isdst=-1), kind=u'date', as_timetuple=False)
    158         return value
    159 
    160     return time.strftime(local_format, value)
    161 
    162 def parse_datetime(value, kind="datetime", as_timetuple=False):
  global time = <module 'time' (built-in)>, time.strftime = <built-in function strftime>, local_format = u'%Y\u5e74%m\u6708%d\u65e5', value = time.struct_time(tm_year=2011, tm_mon=7, tm_mday...0, tm_sec=0, tm_wday=2, tm_yday=208, tm_isdst=-1)
  <type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\u5e74' in position 2: ordinal not in range(128) 
        args = ('ascii', u'%Y\u5e74%m\u6708%d\u65e5', 2, 3, 'ordinal not in range(128)') 
        encoding = 'ascii' 
        end = 3 
        message = '' 
        object = u'%Y\u5e74%m\u6708%d\u65e5' 
        reason = 'ordinal not in range(128)' 
        

  Changing in Languages the default for date format and time format to
  %Y/%m/%d and %H:%M:%S solves the problem.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-client-web/+bug/816799/+subscriptions


Follow ups

References