* [StGit PATCH] mail: Use space rather than tab for long header folding
@ 2010-02-12 15:39 Catalin Marinas
2010-02-12 16:09 ` Karl Wiberg
0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2010-02-12 15:39 UTC (permalink / raw)
To: Karl Wiberg; +Cc: git
The default Python implementation (at least 2.5 and earlier) fold long
e-mail header lines by inserting "\n\t". This causes issues with some
e-mail clients that remove both "\n\t". The RFC2822 shows that folding
should be done with "\n ". The Python workaround is to use a Header
object instead of a string when setting the message headers.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/mail.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index e1de847..34262d3 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -170,7 +170,7 @@ def __get_sender():
def __addr_list(msg, header):
return [addr for name, addr in
- email.Utils.getaddresses(msg.get_all(header, []))]
+ email.Utils.getaddresses(map(str, msg.get_all(header, [])))]
def __parse_addresses(msg):
"""Return a two elements tuple: (from, [to])
@@ -304,7 +304,8 @@ def __send_message(type, tmpl, options, *args):
def __update_header(msg, header, addr = '', ignore = ()):
def __addr_pairs(msg, header, extra):
- pairs = email.Utils.getaddresses(msg.get_all(header, []) + extra)
+ pairs = email.Utils.getaddresses(map(str,
+ msg.get_all(header, []) + extra))
# remove pairs without an address and resolve the aliases
return [address_or_alias(p) for p in pairs if p[1]]
@@ -408,7 +409,8 @@ def __encode_message(msg):
pass
words.append(email.Header.Header(uword).encode())
new_val = ' '.join(words)
- msg.replace_header(header, new_val)
+ msg.replace_header(header,
+ email.Header.Header(new_val, header_name = header))
# encode the body and set the MIME and encoding headers
if msg.is_multipart():
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [StGit PATCH] mail: Use space rather than tab for long header folding
2010-02-12 15:39 [StGit PATCH] mail: Use space rather than tab for long header folding Catalin Marinas
@ 2010-02-12 16:09 ` Karl Wiberg
2010-02-12 16:15 ` Catalin Marinas
0 siblings, 1 reply; 3+ messages in thread
From: Karl Wiberg @ 2010-02-12 16:09 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
On Fri, Feb 12, 2010 at 4:39 PM, Catalin Marinas
<catalin.marinas@arm.com> wrote:
> The default Python implementation (at least 2.5 and earlier) fold long
> e-mail header lines by inserting "\n\t". This causes issues with some
> e-mail clients that remove both "\n\t". The RFC2822 shows that folding
> should be done with "\n ". The Python workaround is to use a Header
> object instead of a string when setting the message headers.
Aha. If this works like I think it does, it'll eliminate the problem
where patches with long subject lines pick up tab characters when
imported from e-mails. But that's not the motivation you're
describing, is it?
--
Karl Wiberg, kha@treskal.com
subrabbit.wordpress.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [StGit PATCH] mail: Use space rather than tab for long header folding
2010-02-12 16:09 ` Karl Wiberg
@ 2010-02-12 16:15 ` Catalin Marinas
0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2010-02-12 16:15 UTC (permalink / raw)
To: Karl Wiberg; +Cc: git
On 12 February 2010 16:09, Karl Wiberg <kha@treskal.com> wrote:
> On Fri, Feb 12, 2010 at 4:39 PM, Catalin Marinas
> <catalin.marinas@arm.com> wrote:
>
>> The default Python implementation (at least 2.5 and earlier) fold long
>> e-mail header lines by inserting "\n\t". This causes issues with some
>> e-mail clients that remove both "\n\t". The RFC2822 shows that folding
>> should be done with "\n ". The Python workaround is to use a Header
>> object instead of a string when setting the message headers.
>
> Aha. If this works like I think it does, it'll eliminate the problem
> where patches with long subject lines pick up tab characters when
> imported from e-mails. But that's not the motivation you're
> describing, is it?
My main motivation is only for sending e-mails as I have an Exchange
server here which removes the tab completely sticking two words
together. If you import an e-mail sent by the patched StGit, yes, it
will solve this as well.
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-12 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-12 15:39 [StGit PATCH] mail: Use space rather than tab for long header folding Catalin Marinas
2010-02-12 16:09 ` Karl Wiberg
2010-02-12 16:15 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).