[plug] MIME Types by file contents

Bernd Felsche bernie at innovative.iinet.net.au
Tue Jul 6 00:44:41 WST 2004


On Monday 05 July 2004 17:47, you wrote:

> There's no documented limitation on what set_payload() handles.
> A subsequent get_payload() produces the correct result, regardless
> of encoding. That brings as_string() to the top of the list of likely
> offenders. The trace shows that Generator() is called and various
> type-specific handlers are called for each part. It's pretty heavy
> going for me trying to figure out what's supposed to be happening in
> the Generator.py

Quite a bite of Googling later, it looks like a similar "bug" already
reported 
  http://mail.python.org/pipermail/email-sig/2003-October/000020.html

The explaination is baffling (to me):

	It's not a bug.  This is caused by the use of the default
	Generator with a message parsed by the HeaderParser. 
	Generator flattens by looking at the Content-Type headers of
	the constituent parts.  It expects to see a message object
	model that jives with the Content-Type headers.  But your
	model doesn't because you've got a message/rfc822 content
	type with a string payload.

	You should probably use a Generator subclass that overrides
	_dispatch().

Way out of my depth on this one... I have no control over that.
Having tried different encodings, charsets and forcing sub-types;
I'm exhausted.

I hate hacking a solution like inserting a blank line at the top of
text/news!

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!






More information about the plug mailing list