jenkins-bot has submitted this change and it was merged.
Change subject: Assume utf-8 encoding for password file
......................................................................
Assume utf-8 encoding for password file
Change-Id: I7fe9fe9842cdb61b8ecb373a2c071b2def54bff2
---
M pywikibot/login.py
1 file changed, 8 insertions(+), 4 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py
index e5b9f97..49cebaa 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -126,22 +126,26 @@
DO NOT FORGET TO REMOVE READ ACCESS FOR OTHER USERS!!!
Use chmod 600 password-file.
+
All lines below should be valid Python tuples in the form
(code, family, username, password) or (username, password)
to set a default password for an username. Default usernames
should occur above specific usernames.
+ If the username or password contain non-ascii characters, they
+ should be stored using the utf-8 encoding.
+
Example:
- ("my_username", "my_default_password")
- ("my_sysop_user", "my_sysop_password")
- ("en", "wikipedia", "my_en_user",
"my_en_pass")
+ (u"my_username", u"my_default_password")
+ (u"my_sysop_user", u"my_sysop_password")
+ (u"en", u"wikipedia", u"my_en_user",
u"my_en_pass")
"""
password_f = open(config.password_file)
for line in password_f:
if not line.strip():
continue
- entry = eval(line)
+ entry = eval(line.decode('utf-8'))
if len(entry) == 2: # for default userinfo
if entry[0] == self.username:
self.password = entry[1]
--
To view, visit
https://gerrit.wikimedia.org/r/81520
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7fe9fe9842cdb61b8ecb373a2c071b2def54bff2
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Toto Azéro <totoazero(a)yahoo.fr>
Gerrit-Reviewer: DrTrigon <dr.trigon(a)surfeu.ch>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Toto Azéro <totoazero(a)yahoo.fr>
Gerrit-Reviewer: jenkins-bot