← Back to team overview

openerp-india team mailing list archive

[Bug 992610] Re: UnicodeEncodeError in ir_cron code due to jobs name

 

** Changed in: openobject-server
   Importance: Undecided => Low

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/992610

Title:
  UnicodeEncodeError in ir_cron code due to jobs name

Status in OpenERP Server:
  Confirmed

Bug description:
  Hello,

  This bug was reproduced on the last commit of openerp-6.1 branch of
  this morning (2012-05-01).

  Yet another unicode error. 'threading.Thread' await a 'name' argument
  that should be already encoded (or convertible to ascii). Bad luck,
  it's job["name"] we are feeding in and this is unicode.

  And this will silently pass until you provide a unicode string that
  contains devils characters.

  2012-05-01 13:22:00,029 6775 WARNING ? openerp.addons.base.ir.ir_cron: Exception in cron:
  Traceback (most recent call last):
    File "/home/vaab/dev/python/openobject-server/openerp/addons/base/ir/ir_cron.py", line 237, in _run_jobs_multithread
      task_thread = threading.Thread(target=self._run_job, name=job['name'], args=(task_cr, job, now))
    File "/opt/apps/python-2.7/lib/python2.7/threading.py", line 433, in __init__
      self.__name = str(name or _newname())
  UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 18: ordinal not in range(128)

  Solution seems easy here:

  job['name'].encode("utf-8")

  is better than job['name'].

  To reproduce, install subscription module, and account, create a subscription type on account.invoice, then a subscription, and put an accentuated character in the name of the subscription: it'll be copied as the name of the ir_cron job.
  Put the according date in ir_cron so that it'll be triggered soon. Then switch watch your openobject-server logs.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/992610/+subscriptions


References