← Back to team overview

openerp-india team mailing list archive

[Bug 944761] Re: [Trunk/6.1] Project GTD unicode error

 

This fix seems straightforward, but It seems more a hack than the
correct fix. Here's why:

- your solution changes the type of res["arch"], it is not anymore a
"utf-8" encoded string but a unicode. This will lead to other bugs of
this sort as everywhere res["arch"] is encoded in "utf-8".

- res["arch"] is always encoded in "utf-8". This is due to "osv/orm.py".
So no surprises here. But, there are no obvious way to tell that
``search_extended`` is unicode by looking to the code as it is build
from simple strings (which are not unicode) in python and gets casted in
unicode by side-effect. This is obviously what caused the original
programmer to let this bug through.

- You can also note that in openobject-server, the habits are to encode
unicode strings before using them. The "encode" function I use came
directly from there.

For these reasons, it seemed much better to propose my patch at:
https://code.launchpad.net/~vaab/openobject-addons/6.1-fix-project-gtd-encoding-issue-5/+merge/99998

I'm open to any discussion on the topic, and will accept any fix on this
code. I'll appreciate any comments on the topics I've brought up. Thank
you for reading.

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

Title:
  [Trunk/6.1] Project GTD unicode error

Status in OpenERP Addons (modules):
  Fix Committed

Bug description:
  When opening Project->My task got error:

  addons/6.1/project_gtd/project_gtd.py", line 118, in fields_view_get
      res['arch'] = res['arch'].replace('<separator name="gtdsep"/>', search_extended)
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

  I think fix is to add unicode() around res['arch'].

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


References