← Back to team overview

openerp-india team mailing list archive

[Bug 1264871] [NEW] email decode header

 

Public bug reported:


Some time when openerp fetch email can't decode header and stop fetch email.

If you won't stop fetch email need some fix.

In module mail. mail_message.py need fix

Original

def decode(text): 
    """Returns unicode() string conversion of the the given encoded smtp header   text""" 
    if text: 
        text = decode_header(text.replace('\r', '')) 
        return ''.join([tools.ustr(x[0], x[1]) for x in text]) 

Fix

def decode(text): 
    """Returns unicode() string conversion of the the given encoded smtp header text""" 

    if text:

        try: 
            text = decode_header(text.replace('\r', '')) 
            result = ''.join([tools.ustr(x[0], x[1]) for x in text]) 
        except: 
            text = 'decode_header Error!' 
            _logger.warning("decode_header Error!") 
            result = text 

        return result

** Affects: openobject-addons
     Importance: Undecided
         Status: New


** Tags: email module

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

Title:
  email decode header

Status in OpenERP Addons (modules):
  New

Bug description:
  
  Some time when openerp fetch email can't decode header and stop fetch email.

  If you won't stop fetch email need some fix.

  In module mail. mail_message.py need fix

  Original

  def decode(text): 
      """Returns unicode() string conversion of the the given encoded smtp header   text""" 
      if text: 
          text = decode_header(text.replace('\r', '')) 
          return ''.join([tools.ustr(x[0], x[1]) for x in text]) 

  Fix

  def decode(text): 
      """Returns unicode() string conversion of the the given encoded smtp header text""" 

      if text:

          try: 
              text = decode_header(text.replace('\r', '')) 
              result = ''.join([tools.ustr(x[0], x[1]) for x in text]) 
          except: 
              text = 'decode_header Error!' 
              _logger.warning("decode_header Error!") 
              result = text 

          return result

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


Follow ups

References