[Patches] [ python-Patches-445433 ] a getPart method for mimetools.Message
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 24 Oct 2001 12:00:43 -0700
Patches item #445433, was opened at 2001-07-27 23:31
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=445433&group_id=5470
Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Richard Jones (richard)
>Assigned to: Barry Warsaw (bwarsaw)
Summary: a getPart method for mimetools.Message
Initial Comment:
This is a getPart method for the mimetools.Message
class. The code comes from the roundup project
(roundup.sf.net) ... it seems odd that
mimetools.Message doesn't provide this
out-of-the-box. Anyway, it's simple enough. There is
a unit test for this code in the roundup test
directory.
class Message(mimetools.Message):
def getPart(self)
boundary = self.getparam('boundary')
mid, end = '--'+boundary, '--'+boundary+'--'
s = cStringIO.StringIO()
while 1:
line = self.fp.readline()
if not line:
break
if line.strip() in (mid, end):
break
s.write(line)
if not s.getvalue().strip():
return None
s.seek(0)
return Message(s)
----------------------------------------------------------------------
>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-10-24 12:00
Message:
Logged In: YES
user_id=12800
After Pythonlabs discussion, we decided that we're going to
deprecate the mimetool module, which means we'll continue to
fix it but won't add new features. Rejecting the patch and
stealing it from Guido.
----------------------------------------------------------------------
Comment By: Richard Jones (richard)
Date: 2001-10-21 04:45
Message:
Logged In: YES
user_id=6405
I seem to recall it was only a number of days after I
submitted this that the mimetool replacement was annouced
:)
It'd be bad to have duplication in the library - it's just
a shame that all that old code is going to have to be
migrated. Same thing happened when we moved from regex to
re I suppose (though there were significant incompatible
syntax changes with that - I assume the same is the case
with this?)
----------------------------------------------------------------------
Comment By: Barry Warsaw (bwarsaw)
Date: 2001-10-18 16:01
Message:
Logged In: YES
user_id=12800
A bigger question is whether we should continue to support
mimetool now that the email package is part of the standard
library? email's Message class supports this via its
get_payload() method.
Should we deprecate mimetools for Python 2.2? Assigning to
Guido for his opinion. Note that other candidates for
deprecation include MimeWriter and mimify (although the
latter has support for being run as a command line script --
I wonder if anybody actually uses that?).
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=445433&group_id=5470