You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Igor Galić <i....@brainsware.org> on 2012/09/04 18:58:28 UTC

[PATCH]: Encoding fix mailer.py

Hey folks,

I've patched up my local mailer.py[1] to correctly encode
"From: " Headers.

The attached patch *works* but it's not pretty.

Someone who actually knows Python might want to encapsulate
my changes in a function.

n.b.: I am not subscribed to this ML, if you want notify me
of updates, please CC me.

So long,

i

[1] http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/mailer/mailer.py

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


Re: [PATCH]: Encoding fix mailer.py

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 11/13/2012 03:19 AM, Igor Galić wrote:
>>>
>>> Igor, I took a look at your patch.  I was confused by one aspect:
>>> why split
>>> the from_addr into words an encode each one individually, rather
>>> than
>>> encoding the whole header value like we do for the Subject: header?
>>> I dug
>>> around in the related RFCs, and if I'm reading the RFCs correctly,
>>> doing
>>> per-word encoding is actually the right thing to do.  Should we,
>>> then, do
>>> the same for the Subject: header?
>>
>> Attaching my current modification of your original patch.
> 
> My python-fu hasn't really improved since then, but looking at
> your code it looks as though you're not importing email.Header
> in a loop at least ;)

True.  But ... uh ... any response on the more meaningful questions I asked
of you in this thread?

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development


Re: [PATCH]: Encoding fix mailer.py

Posted by Igor Galić <i....@brainsware.org>.
> > 
> > Igor, I took a look at your patch.  I was confused by one aspect:
> > why split
> > the from_addr into words an encode each one individually, rather
> > than
> > encoding the whole header value like we do for the Subject: header?
> > I dug
> > around in the related RFCs, and if I'm reading the RFCs correctly,
> > doing
> > per-word encoding is actually the right thing to do.  Should we,
> > then, do
> > the same for the Subject: header?
> 
> Attaching my current modification of your original patch.

My python-fu hasn't really improved since then, but looking at
your code it looks as though you're not importing email.Header
in a loop at least ;)


> --
> C. Michael Pilato <cm...@collab.net>
> CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development
> 

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


Re: [PATCH]: Encoding fix mailer.py

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 11/09/2012 09:31 AM, C. Michael Pilato wrote:
> On 09/04/2012 12:58 PM, Igor Galić wrote:
>> Hey folks,
>>
>> I've patched up my local mailer.py[1] to correctly encode
>> "From: " Headers.
>>
>> The attached patch *works* but it's not pretty.
>>
>> Someone who actually knows Python might want to encapsulate
>> my changes in a function.
>>
>> n.b.: I am not subscribed to this ML, if you want notify me
>> of updates, please CC me.
>>
>> So long,
>>
>> i
>>
>> [1] http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/mailer/mailer.py
>>
> 
> Igor, I took a look at your patch.  I was confused by one aspect: why split
> the from_addr into words an encode each one individually, rather than
> encoding the whole header value like we do for the Subject: header?  I dug
> around in the related RFCs, and if I'm reading the RFCs correctly, doing
> per-word encoding is actually the right thing to do.  Should we, then, do
> the same for the Subject: header?

Attaching my current modification of your original patch.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development

Re: [PATCH]: Encoding fix mailer.py

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 09/04/2012 12:58 PM, Igor Galić wrote:
> Hey folks,
> 
> I've patched up my local mailer.py[1] to correctly encode
> "From: " Headers.
> 
> The attached patch *works* but it's not pretty.
> 
> Someone who actually knows Python might want to encapsulate
> my changes in a function.
> 
> n.b.: I am not subscribed to this ML, if you want notify me
> of updates, please CC me.
> 
> So long,
> 
> i
> 
> [1] http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/mailer/mailer.py
> 

Igor, I took a look at your patch.  I was confused by one aspect: why split
the from_addr into words an encode each one individually, rather than
encoding the whole header value like we do for the Subject: header?  I dug
around in the related RFCs, and if I'm reading the RFCs correctly, doing
per-word encoding is actually the right thing to do.  Should we, then, do
the same for the Subject: header?

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development