[Python-bugs-list] [ python-Bugs-676072 ] rfc822.Message() doesn't support __contains__() (+patch)
SourceForge.net
noreply@sourceforge.net
Thu, 30 Jan 2003 19:41:28 -0800
Bugs item #676072, was opened at 2003-01-28 08:32
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=676072&group_id=5470
Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Michal Vitecek (fufsource)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: rfc822.Message() doesn't support __contains__() (+patch)
Initial Comment:
class rfc822.Message() should behave like a dictionary
but it doesn't define method __contains__() so it's not
possible to use form:
'header' in messageInstance
attached is a simple patch that fixes this.
----------------------------------------------------------------------
>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-01-30 22:41
Message:
Logged In: YES
user_id=12800
It's not entirely clear to me that Messages should have
dictionary semantics, or that you should be able to say
"header in msginst". I don't think I'd want those semantics
for email.Message.
Messages are more than just a collection of their headers.
Why wouldn't __contains__ test for a subpart in a message
tree, or for some text in the body of the message? Also, in
email.Message, __getitem__ etc don't have dict semantics on
purpose.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-30 18:40
Message:
Logged In: YES
user_id=80475
I've attached my own version of this patch for Py2.3.
The same solution was used for shelve so that a
single minimal intervention keeps the module
fully synced with mapping interface. I know this
module is superceded but it doesn't hurt to sync-up
its interface for those who still use it.
Barry, if it meets your approval please reassign
back to me.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=676072&group_id=5470