project_gtd can't display "My Tasks" in non-ascii languages

Bug #968028 reported by Valentin Lab
This bug report is a duplicate of:  Bug #944761: [Trunk/6.1] Project GTD unicode error. Edit Remove
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

Step to reproduce from scratch:

1 - create a new database with "french" as default language
2 - install module project_gtd
3 - try to access Projects/My Task view

I'm using rev corresponding to 6.1 tag.
I'm providing a video to show the bug.

Here is the exception I get:

Traceback (most recent call last):
  File "/home/vaab/dev/python/openobject-server/openerp/netsvc.py", line 361, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/vaab/dev/python/openobject-server/openerp/service/web_services.py", line 604, in dispatch
    res = fn(db, uid, *params)
  File "/home/vaab/dev/python/openobject-server/openerp/osv/osv.py", line 167, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/vaab/dev/python/openobject-server/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/vaab/dev/python/openobject-server/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/vaab/dev/python/openobject-server/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/vaab/dev/python/openobject-addons_old/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)

DIAGNOSTIC

In the failing line:

   res['arch'] = res['arch'].replace('<separator name="gtdsep"/>', search_extended)

"res['arch']" is encoded in utf-8, but "search_extended" is unicode. In english language, this is not a problem as "res['arch']" can be decoded from utf-8 to unicode using the "ascii" codec. This is not the case for french language, if it uses accentuated characters, which is the case here with the word: "Tâche" for example.

Related branches

Revision history for this message
Valentin Lab (vaab) wrote :

The video seems to have disappeared for some reason. Here it is.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Valentin,

Thanks for the reply and useful video. Problem occurs only without demodata.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Valentin,

Thanks for your merge but here no need to create a method for encode because by using
            res['arch'] = unicode(res['arch'], 'utf-8').replace('<separator name="gtdsep"/>', search_extended) at line#118 fields_view_get
of project_gtd.py. Which is solved the problem.

So as per the code optimisation we no need to create solution as you suggested.

And this issue is already posted on lp:944761, That's why I am setting this as a duplicate of lp:944761

Thanks

Revision history for this message
Valentin Lab (vaab) wrote :

I ask you to reconcider my patch, but I'll post the reason why on the duplicate bug report. Thanks for finding that duplication !

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.