← Back to team overview

openerp-india team mailing list archive

[Bug 921442] Re: [6.0/trunk] Encoding trouble in mail_message parsing and base_action_rule processing

 

The fix for the first part of the bug report was merged in 6.0 and 6.1
at revision [1][2], updating status accordingly.

Concerning the second part of the bug report that is mostly unrelated, it is still not reproducible. All the described methods to reproduce do not seem to produce errors, except when directly injecting the error in the code of OpenERP itself, which does not prove it can happen with a normal e-mail. As a result, I'm afraid the proposed patch will not fix what it claims.
In addition, that patch is wrong for several reasons, discussed in the review of the [3] branch. Encoding issues are sometimes complex and if you jump too quickly to conclusions you risk breaking something else that is more important than the corner case you are trying to correct.

Perhaps the best way to make sure we properly fix that second part is to
send us the source of a real email file that triggers the problem, as
you seem to have seen one. You can safely anonymize the content of the
email you manage to do it. Otherwise you can e-mail it to me (as an
attachment) and I will see how we can make a proper patch. It might also
make sense to handle this in a separate bug report.

For further discussion on the actual patch, do not hesitate to comment
on [3].

Thanks,

[1] 6.0 rev. 5075 rev-id: xal@xxxxxxxxxxx-20120221092224-zq125yq9aj5lcqk6
[2] 6.1 rev. 6679 rev-id: odo@xxxxxxxxxxx-20120316144251-ks16hvvfgh2hiduk
[3] lp:~openerp-dev/openobject-addons/trunk-bug-921442-nco

** Changed in: openobject-addons/6.1
   Importance: Undecided => Low

** Changed in: openobject-addons/6.1
       Status: New => Fix Released

** Changed in: openobject-addons/6.1
    Milestone: None => 6.1

** Changed in: openobject-addons/6.1
     Assignee: (unassigned) => OpenERP R&D Addons Team 1 (openerp-dev-addons1)

-- 
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/921442

Title:
  [6.0/trunk] Encoding trouble in mail_message parsing and
  base_action_rule processing

Status in OpenERP Addons (modules):
  Fix Released
Status in OpenERP Addons 6.0 series:
  Fix Released
Status in OpenERP Addons 6.1 series:
  Fix Released

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(str(reg_name))
              _result = ptrn.search(str(obj.name))

  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

  
  Ref: http://docs.python.org/howto/unicode.html

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


References