[Email-SIG] Patch: Improve recognition of attachment file name, with encodings

Nando nando at acapela.com.br
Wed Feb 13 18:20:30 CET 2008


I have a second suggestion to that same Message.get_filename() method.

It needs to understand filenames that come with text encodings.

The proposed patch is in the attached text file.

Thank you for your time...

Nando Florestan
===============
[skype]    nandoflorestan
[phone]  + 55 (11) 3675-3038
[mobile] + 55 (11) 9820-5451
[internet] http://oui.com.br/
[À Capela] http://acapela.com.br/
[location] São Paulo - SP - Brasil



Nando wrote:
> Greetings, Mr. Barry Warsaw and all other Pythonistas,
>
> How do you like this little patch?
>
> $ svn diff
> Index: message.py
> ===================================================================
> --- message.py  (revision 60758)
> +++ message.py  (working copy)
> @@ -671,7 +671,10 @@
>          filename = self.get_param('filename', missing, 
> 'content-disposition')
>          if filename is missing:
>              filename = self.get_param('name', missing, 
> 'content-disposition')
> +        # nando: Some messages specify the file name of attachment this 
> way:
>          if filename is missing:
> +            filename = self.get_param('name', missing, 'content-type')
> +        if filename is missing:
>              return failobj
>          return utils.collapse_rfc2231_value(filename).strip()
>
>
> This is the first time I collaborate this way, so if there is anything 
> else I can do to help, let me know, cause I am sort of ignorant.
>
>   
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.txt
Url: http://mail.python.org/pipermail/email-sig/attachments/20080213/fc27c5fe/attachment.txt 


More information about the Email-SIG mailing list