[6.0/trunk] Encoding trouble in mail_message parsing and base_action_rule processing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP R&D Addons Team 1 | ||
6.0 |
Fix Released
|
Low
|
OpenERP Publisher's Warranty Team | ||
6.1 |
Fix Released
|
Low
|
OpenERP R&D Addons Team 1 |
Bug Description
hi,
We've got an issue with encoding in the crm part. This will be difficult to reproduce.. :( So, please look at the code to understand the problem..
First bug part : Parsing the rules (base_action_rule) breaks if the regexp or the name of the resource (model) has some non-string char. In the function do_chek you have :
if reg_name:
ptrn = re.compile(
_result = ptrn.search(
Calling str() method here breaks if some unknown char are present in the object name or in the regexp name it-self.
See my patch, I suggest to just remove that call to str() as both are already in unicode which is perfect => no need to convert with str().
Second part: Fetching mail when some character are broken in the body_html part. It could happend that you receive an email with broking characters in it, you should not block everything because of that. Currently, if it happend, no other mail are fetched, and you got an PostgreSQL error when trying to write it in DB : invalid byte sequence for encoding "UTF8": 0xe96ce9
In the parse_message of mail_message.py, you make everything to take care of the coding, nothing to improve there I think. But, if the message (body_html) contain broken char (I mean non-valid one, not a coding trouble, like in this example : unicode('abcdef' + chr(255))), then it breaks the mail fetching.
As body_text is encoded in unicode, I suggest the same in my patch, but with the option errors=ignore. This way we skip all non-conform char, and ensure the write method will only write valid char in DB.
The provided patch worked on more than 900 mails, so I think it's good.
Thanks for your consideration,
Regards,
Joël
Related branches
- Naresh(OpenERP) (community): Approve
- Rifakat Husen (OpenERP) (community): Needs Resubmitting
-
Diff: 30 lines (+4/-4)2 files modifiedbase_action_rule/base_action_rule.py (+2/-2)
crm/crm_action_rule.py (+2/-2)
- Olivier Dony (Odoo): Disapprove
- Raphael Collet (OpenERP) (community): Needs Information
-
Diff: 60 lines (+9/-4)3 files modifiedbase_action_rule/base_action_rule.py (+3/-2)
crm/crm_action_rule.py (+3/-2)
mail/mail_message.py (+3/-0)
- OpenERP Core Team: Pending requested
-
Diff: 46 lines (+6/-4)2 files modifiedbase_action_rule/base_action_rule.py (+3/-2)
crm/crm_action_rule.py (+3/-2)
summary: |
- Encoding trouble in mail_message parsing and base_action_rule processing + [6.0/trunk] Encoding trouble in mail_message parsing and + base_action_rule processing |
Changed in openobject-addons: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |
no longer affects: | openobject-addons/trunk |
Hello Joël Grand-Guillaume ,
I have checked this issue with trunk and I face the
problem of First Part but Second part of bug is not reproduce
at my end so would you please elaborate more regarding
second part of this issue with video or proper steps.
Thanks and waiting for reply.