[Trunk/6.1] Project GTD unicode error

Bug #944761 reported by Paulius Sladkevičius @ hbee
40
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 1

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'].

Tags: maintenance

Related branches

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Paulius,

I have checked your issue in both Gtk and Web.But it's working fine for me .
Would you please provide more information on this issue.

Thanks!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Ravish,

firstly you must have project_gtk installed. Next go to Project->My task. You will get this error.

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Paulius,

I have checked again but result is same. Now I have attached video for your more reference .Please go throw it.
If you still faced the problem , Please provide descriptive and sufficient information .So we can solved it out.

Thanks!!!

Revision history for this message
jmddd (jeanmarie-duminger) wrote :

Hello Ravish,

Same error occurs on my 6.1.1 system. Maybe it is limited to the French language version according to the forum topic (http://www.openerp.com/forum/post96245.html?hilit=my%20tasks#p96245).
After the first error message "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)", as related by Paulius, and a few operations around project and tasks, the message has become : "File "/opt/openerp/server/openerp/addons/project_gtd/project_gtd.py", line 118, in fields_view_get
    res['arch'] = res['arch'],replace('<separator name="gtdsep"/>', search_extended)
NameError: global name 'replace' is not defined".

This happens as well in Sales/My Tasks or Project / My Tasks

Ready to give you more info if needed.

Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

Ravish,

yes, I forgot to mention to test with other languages, so Jean-marie could be right.

Revision history for this message
jmddd (jeanmarie-duminger) wrote :

After some testing, I changed the following code in project_gtd.py, as suggested in the above mentioned forum topic and by Paulius :

            search_extended +='''<separator orientation="vertical"/>'''
# res['arch'] = res['arch'].replace('<separator name="gtdsep"/>', search_extended)
            res['arch'] = unicode(res['arch'], 'utf-8').replace('<separator name="gtdsep"/>', search_extended)

... and it works, but I don't know why ;-)

Revision history for this message
Lorenzo Battistini (elbati) wrote :

This happens if you open 'my tasks' with italian language too

Changed in openobject-addons:
status: Incomplete → New
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

I have faced the same problem when create a db with French language without demo data then encoding problem is occurs.

Would you please look in to lp:968028

Thanks

Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
status: New → Confirmed
Amit Parik (amit-parik)
Changed in openobject-addons:
status: Confirmed → In Progress
summary: - [6.1] Project GTD unicode error
+ [Trunk/6.1] Project GTD unicode error
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Folks,

Thanks for the reporting!

This issue has been fixed on lp:~openerp-dev/openobject-addons/trunk-bug-944761-amp branch with following rev no and rev ID.

rev no: 6704
rev ID : 6704 <email address hidden>

It will be merge with trunk soon.

Thanks again!

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Valentin Lab (vaab) wrote :

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.

tags: added: maintenance
Revision history for this message
qdp (OpenERP) (qdp) wrote :

fixed in trunk by revision 6950

thanks
Quentin

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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