Commit 508e81ed authored by Raymond Hettinger's avatar Raymond Hettinger

Convert splitlines to for-loop (handles case where input does not have a trailing newline).

parent a9620d1e
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment