librelist archives

« back to archive

multipart/related

multipart/related

From:
Joseph Kondel
Date:
2011-02-17 @ 19:30
Is there a standardized way of handling multipart/related emails when 
working with Lamson? 

I try calling the to_message() method on the MailRequest object handed to 
my handler and it's erroring out with the following traceback:

Traceback (most recent call last):
File "/home/ubuntu/platform/lib/celery/execute/trace.py", line 34, in trace
  return cls(states.SUCCESS, retval=fun(*args, **kwargs))
File "/home/ubuntu/platform/lib/celery/task/base.py", line 248, in __call__
  return self.run(*args, **kwargs)
File "/home/ubuntu/platform/lib/celery/decorators.py", line 52, in run
  return fun(*args, **kwargs)
File "/home/ubuntu/platform/inbound_email/tasks.py", line 102, in 
message_center_reply_via_email
  if message.to_message().is_multipart():
File 
"/usr/local/lib/python2.6/dist-packages/lamson-1.1-py2.6.egg/lamson/mail.py",
line 129, in to_message
  return encoding.to_message(self.base)
File 
"/usr/local/lib/python2.6/dist-packages/lamson-1.1-py2.6.egg/lamson/encoding.py",
line 271, in to_message
  (ctype, params, exc.message))
EncodingError: Content-Type malformed, not allowed: 'multipart/related'; 
{'type': 'multipart/alternative'} (Python ERROR: __init__() got multiple 
values for keyword argument 'type'

Is there a suggested way to go about pulling these types of messages apart
"the lamson way" ? 

-j

Re: [lamson] multipart/related

From:
Zed A. Shaw
Date:
2011-02-17 @ 20:21
On Thu, Feb 17, 2011 at 02:30:41PM -0500, Joseph Kondel wrote:
> EncodingError: Content-Type malformed, not allowed: 'multipart/related';
{'type': 'multipart/alternative'} (Python ERROR: __init__() got multiple 
values for keyword argument 'type'

Hmm, looks like a bug, or maybe something changed in Python 2.6.

> Is there a suggested way to go about pulling these types of messages
> apart "the lamson way" ? 

Any chance you can try to fix it?  It looks like a bug for sure, I'm
just not sure I'll have the time to find out why.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [lamson] multipart/related

From:
Joseph Kondel
Date:
2011-02-17 @ 20:32
Yeah, I had already started poking around in the source before hitting the
email list up in case there was something I was missing. 

If/when I resolve it I'll be sure to submit a patch for you to review.

Thanks for the quick response and for lamson!

-j

On Feb 17, 2011, at 3:21 PM, Zed A. Shaw wrote:

On Thu, Feb 17, 2011 at 02:30:41PM -0500, Joseph Kondel wrote:
> EncodingError: Content-Type malformed, not allowed: 'multipart/related';
{'type': 'multipart/alternative'} (Python ERROR: __init__() got multiple 
values for keyword argument 'type'

Hmm, looks like a bug, or maybe something changed in Python 2.6.

> Is there a suggested way to go about pulling these types of messages
> apart "the lamson way" ? 

Any chance you can try to fix it?  It looks like a bug for sure, I'm
just not sure I'll have the time to find out why.

-- 
Zed A. Shaw
http://zedshaw.com/