diff options
author | James Sexton <TwistedLadder@gmail.com> | 2017-09-30 07:10:31 (GMT) |
---|---|---|
committer | INADA Naoki <methane@users.noreply.github.com> | 2017-09-30 07:10:31 (GMT) |
commit | b24cd055ecb3eea9a15405a6ca72dafc739e6531 (patch) | |
tree | e9f867fac0d88a8e9f5d3caea0d0b067244c35df /Lib/netrc.py | |
parent | 3d2b407da048b14ba6e5eb6079722a785d210590 (diff) | |
download | cpython-b24cd055ecb3eea9a15405a6ca72dafc739e6531.zip cpython-b24cd055ecb3eea9a15405a6ca72dafc739e6531.tar.gz cpython-b24cd055ecb3eea9a15405a6ca72dafc739e6531.tar.bz2 |
bpo-30806 netrc.__repr__() is broken for writing to file (GH-2491)
netrc file format doesn't support quotes and escapes.
See https://linux.die.net/man/5/netrc
Diffstat (limited to 'Lib/netrc.py')
-rw-r--r-- | Lib/netrc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/netrc.py b/Lib/netrc.py index aa8eea3..baf8f1d 100644 --- a/Lib/netrc.py +++ b/Lib/netrc.py @@ -127,15 +127,15 @@ class netrc: rep = "" for host in self.hosts.keys(): attrs = self.hosts[host] - rep = rep + "machine "+ host + "\n\tlogin " + repr(attrs[0]) + "\n" + rep += f"machine {host}\n\tlogin {attrs[0]}\n" if attrs[1]: - rep = rep + "account " + repr(attrs[1]) - rep = rep + "\tpassword " + repr(attrs[2]) + "\n" + rep += f"\taccount {attrs[1]}\n" + rep += f"\tpassword {attrs[2]}\n" for macro in self.macros.keys(): - rep = rep + "macdef " + macro + "\n" + rep += f"macdef {macro}\n" for line in self.macros[macro]: - rep = rep + line - rep = rep + "\n" + rep += line + rep += "\n" return rep if __name__ == '__main__': |