VcamX has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/190638

Change subject: Normalize usernames in password file
......................................................................

Normalize usernames in password file

Capitalize the first letter of username in password file when used according to
Wikipedia username policy.

Bug: T74974
Change-Id: I2035bf03bad62f6f505b2a9129758c2cc4f6b5ce
---
M pywikibot/login.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/38/190638/1

diff --git a/pywikibot/login.py b/pywikibot/login.py
index db7be8f..5213812 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -169,7 +169,11 @@
         for line in password_f:
             if not line.strip():
                 continue
-            entry = eval(line)
+            entry = list(eval(line))
+            if len(entry) < 2 or len(entry) > 4:
+                continue
+            if not self.site.nocapitalize:
+                entry[-2] = entry[-2][0].upper() + entry[-2][1:]
             if len(entry) == 4:         # for userinfo included code and family
                 if entry[0] == self.site.code and \
                    entry[1] == self.site.family.name and \

-- 
To view, visit https://gerrit.wikimedia.org/r/190638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2035bf03bad62f6f505b2a9129758c2cc4f6b5ce
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: VcamX <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to