You are not logged in.

#1 2010-12-13 01:09:46

print
Member
Registered: 2007-02-27
Posts: 174

email.message.Message is_multipart() always returns False

Calling arch python gurus . . .

It appears that when using the HeaderParser() sub-class of the Parser() class, or Parser(.., headersonly=True), is_multpart() returns False regardless of whether a given message is multipart or not.  Is this a bug or a feature?  I guess this function shouldn't matter to you if you're only interested in the headers, however IIRC the entire message is read anyway, even if headersonly=True or HeaderParser is in use.

% python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

 class EmailHeaderParser():
     def __init__(self, fp):
         from pprint import pprint
         self.headers = HeaderParser().parse(fp, headersonly=True)
         # self.headers = HeaderParser().parse(fp)
         pprint(self.headers.is_multipart()) # always False
         print

thanks


% whereis whatis whence which whoami whois who

Offline

Board footer

Powered by FluxBB