Mercurial > hg
comparison hgext/notify.py @ 7673:af4871b73be7
notify: fix neglect of custom headers set via template
e981725da3fe introduced a bug that discarded all custom headers.
Add custom header to test template.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Thu, 15 Jan 2009 01:38:52 +0100 |
parents | 64840fcb79e1 |
children | c55e68e8f256 |
comparison
equal
deleted
inserted
replaced
7668:876de22b70b8 | 7673:af4871b73be7 |
---|---|
183 p = email.Parser.Parser() | 183 p = email.Parser.Parser() |
184 msg = p.parsestr(data) | 184 msg = p.parsestr(data) |
185 | 185 |
186 # store sender and subject | 186 # store sender and subject |
187 sender, subject = msg['From'], msg['Subject'] | 187 sender, subject = msg['From'], msg['Subject'] |
188 del msg['From'], msg['Subject'] | |
189 # store remaining headers | |
190 headers = msg.items() | |
188 # create fresh mime message from msg body | 191 # create fresh mime message from msg body |
189 text = msg.get_payload() | 192 text = msg.get_payload() |
190 # for notification prefer readability over data precision | 193 # for notification prefer readability over data precision |
191 msg = mail.mimeencode(self.ui, text, self.charsets, self.test) | 194 msg = mail.mimeencode(self.ui, text, self.charsets, self.test) |
195 # reinstate custom headers | |
196 for k, v in headers: | |
197 msg[k] = v | |
192 | 198 |
193 def fix_subject(subject): | 199 def fix_subject(subject): |
194 '''try to make subject line exist and be useful.''' | 200 '''try to make subject line exist and be useful.''' |
195 | 201 |
196 if not subject: | 202 if not subject: |