Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ce96d8b6
Commit
ce96d8b6
authored
Sep 22, 2004
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1030125: rfc822 __iter__ problem
Add iteration support to the Message class.
parent
c6646c09
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
Lib/rfc822.py
Lib/rfc822.py
+3
-0
Lib/test/test_rfc822.py
Lib/test/test_rfc822.py
+11
-0
Misc/NEWS
Misc/NEWS
+1
-0
No files found.
Lib/rfc822.py
View file @
ce96d8b6
...
...
@@ -444,6 +444,9 @@ class Message:
"""Determine whether a message contains the named header."""
return
name
.
lower
()
in
self
.
dict
def
__iter__
(
self
):
return
iter
(
self
.
dict
)
def
keys
(
self
):
"""Get all of a message's header field names."""
return
self
.
dict
.
keys
()
...
...
Lib/test/test_rfc822.py
View file @
ce96d8b6
...
...
@@ -176,6 +176,17 @@ class MessageTestCase(unittest.TestCase):
'foo'
,
[(
''
,
'guido@[132.151.1.21]'
)])
def
test_iter
(
self
):
m
=
rfc822
.
Message
(
StringIO
(
'Date: Wed, 13 Jan 1999 23:57:35 -0500
\
n
'
'From: Guido van Rossum <guido@CNRI.Reston.VA.US>
\
n
'
'To: "Guido van
\
n
'
'
\
t
: Rossum" <guido@python.org>
\
n
'
'Subject: test2
\
n
'
'
\
n
'
'test2
\
n
'
))
self
.
assertEqual
(
sorted
(
m
),
[
'date'
,
'from'
,
'subject'
,
'to'
])
def
test_rfc2822_phrases
(
self
):
# RFC 2822 (the update to RFC 822) specifies that dots in phrases are
# obsolete syntax, which conforming programs MUST recognize but NEVER
...
...
Misc/NEWS
View file @
ce96d8b6
...
...
@@ -21,6 +21,7 @@ Extension modules
Library
-------
- rfc822 Messages now support iteration.
- The (undocumented) tarfile.Tarfile.membernames has been removed;
applications should use the getmember function.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment