Nimesh Contractor(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-921442-nco into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #921442 in OpenERP Addons: "[6.0/trunk] Encoding trouble in mail_message 
parsing and base_action_rule processing"
  https://bugs.launchpad.net/openobject-addons/+bug/921442

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-921442-nco/+merge/93940

Hello,

     For encoding trouble: encode the string in unicode, I have applied patch 
of Joël Grand-Guillaume @ CampToCamp (jgrandguillaume-c2c) and its working fine.

Thanks,
 NCO.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-921442-nco/+merge/93940
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-921442-nco.
=== modified file 'base_action_rule/base_action_rule.py'
--- base_action_rule/base_action_rule.py	2011-12-27 09:27:00 +0000
+++ base_action_rule/base_action_rule.py	2012-02-21 09:12:25 +0000
@@ -28,6 +28,7 @@
 import re
 import time
 import tools
+from openerp.loglevels import ustr 
 
 
 def get_datetime(date_field):
@@ -369,8 +370,8 @@
         reg_name = action.regex_name
         result_name = True
         if reg_name:
-            ptrn = re.compile(str(reg_name))
-            _result = ptrn.search(str(obj.name))
+            ptrn = re.compile(ustr(reg_name))
+            _result = ptrn.search(ustr(obj.name))
             if not _result:
                 result_name = False
         regex_n = not reg_name or result_name

=== modified file 'crm/crm_action_rule.py'
--- crm/crm_action_rule.py	2011-12-20 15:29:31 +0000
+++ crm/crm_action_rule.py	2012-02-21 09:12:25 +0000
@@ -27,6 +27,7 @@
 from osv import osv
 
 import crm
+from openerp.loglevels import ustr 
 
 class base_action_rule(osv.osv):
     """ Base Action Rule """
@@ -73,9 +74,9 @@
         regex = action.regex_history
         if regex:
             res = False
-            ptrn = re.compile(str(regex))
+            ptrn = re.compile(ustr(regex))
             for history in obj.message_ids:
-                _result = ptrn.search(str(history.name))
+                _result = ptrn.search(ustr(history.subject))
                 if _result:
                     res = True
                     break

=== modified file 'mail/mail_message.py'
--- mail/mail_message.py	2012-01-31 13:36:57 +0000
+++ mail/mail_message.py	2012-02-21 09:12:25 +0000
@@ -453,6 +453,9 @@
 
             msg['body_text'] = body
         msg['attachments'] = attachments
+        # For encoding trouble: encode the string in unicode, ignoring unkown byte
+        if 'body_html' in msg and isinstance(msg['body_html'],str):
+            msg['body_html'] = unicode(msg['body_html'], errors='ignore')
 
         # for backwards compatibility:
         msg['body'] = msg['body_text']

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to