[Email-SIG] fixing the current email module

Barry Warsaw barry at python.org
Fri Oct 9 13:56:12 CEST 2009


On Oct 8, 2009, at 5:29 PM, Stephen J. Turnbull wrote:

> Most non-text media do support comments, though.  I don't know if
> extracting comments is a reasonable response to a request for text
> from an image, but we should provide a place to put any text that the
> callbacks that do the actual work of decoding might return.

Are you talking about comments embedded in things like id3 tags and  
jpg comments?  If so, ISTM those are outside the scope of the email  
package.  Message objects can return decoded payloads, but I don't  
think it should provide the framework for looking inside those payloads.

>>> However, I think it is proper that a MIME part that is not flagged
>>> as text/* might produce an error if asked for as text.
>>
>> +1
>
> That doesn't preclude raising an error/returning a defect object in
> many or most use cases, but there may be use cases where it would be
> useful to allow a callback on a non-text object to return text.

I think we should re-cast the discussion in terms of returning raw and  
decoded payloads.  The email package can provide methods for returning  
raw payloads as bytes and decoded payloads in the natural type as  
described by Content-Type.  For the latter, we probably need a  
registration and plugin system to handle types that email doesn't know  
about by default, but it should also be used to handle types it does  
know about.  That way, an application could override e.g. decoding  
text/html content if it wanted to.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 832 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/email-sig/attachments/20091009/f218d684/attachment.pgp>


More information about the Email-SIG mailing list