← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 703958] Re: mail_gateway proposal to add 'headers' item to msg

 

xrg,

In this patch I opt for simplicity, thus I opted not to remove useless
headers.

This however does not mean it is stored in database immediatly, I just pass along the headers in the dictionary that is passed to message_new() method function.
(The one you should define if you want to be able to create records for your model from a mail).

The method function can then decide to discard or store wanted header
parts, afaik it is not stored inside the database at all.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/703958

Title:
  mail_gateway proposal to add 'headers' item to msg

Status in OpenERP Modules (addons):
  Confirmed

Bug description:
  I propose we add a new item to the dictionary, we already have
  msg['body'] and msg['from'] etc but "unsupported" headers get lost in
  this function, therefor I suggest we add an item msg['headers']
  containing pairs of name, value.

  Here is how it should look :

  === modified file 'addons/mail_gateway/mail_gateway.py'
  --- addons/mail_gateway/mail_gateway.py 2010-11-16 09:51:53 +0000
  +++ addons/mail_gateway/mail_gateway.py 2010-12-07 16:39:01 +0000
  @@ -481,6 +481,9 @@
           if 'X-Priority' in fields:
               msg['priority'] = msg_txt.get('X-Priority', '3 (Normal)').split(' ')[0]
   
  +        # Store the other headers
  +        msg['headers'] = dict(msg_txt.items())
  +
           if not msg_txt.is_multipart() or 'text/plain' in msg.get('Content-Type', ''):
               encoding = msg_txt.get_content_charset()
               body = msg_txt.get_payload(decode=True)





References