summaryrefslogtreecommitdiff
path: root/Lib/rfc822.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-02-08 15:39:11 +0000
committerRaymond Hettinger <python@rcn.com>2005-02-08 15:39:11 +0000
commitb37d5aa8d3e6fea8322c50378bcf76d16c4dd00e (patch)
tree76eda786de668a6ce968a5f50e06eff0da34a6d7 /Lib/rfc822.py
parent18e655a474c834983c72740c36669f776b23933b (diff)
downloadcpython-b37d5aa8d3e6fea8322c50378bcf76d16c4dd00e.tar.gz
Convert splitlines to for-loop (handles case where input does not have a trailing newline).
Diffstat (limited to 'Lib/rfc822.py')
-rw-r--r--Lib/rfc822.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
index 4448e7d542..871a049c21 100644
--- a/Lib/rfc822.py
+++ b/Lib/rfc822.py
@@ -393,8 +393,8 @@ class Message:
del self[name] # Won't fail if it doesn't exist
self.dict[name.lower()] = value
text = name + ": " + value
- self.headers.extend(text.splitlines(True))
- self.headers.append('\n')
+ for line in text.split("\n"):
+ self.headers.append(line + "\n")
def __delitem__(self, name):
"""Delete all occurrences of a specific header, if it is present."""
@@ -423,8 +423,8 @@ class Message:
return self.dict[lowername]
else:
text = name + ": " + default
- self.headers.extend(text.splitlines(True))
- self.headers.append('\n')
+ for line in text.split("\n"):
+ self.headers.append(line + "\n")
self.dict[lowername] = default
return default