jenkins-bot merged this change.
[bugfix] Do not change usernames when creating a Site
usernames is a defaultdict which inserts a new item if
it does not already exists. Therefore
code_to_user = config.usernames['*'].copy()
inserts an empty dict with '*' if it not already exists
but this changes the usernames and lead scripts to fail.
Bug: T253127
Change-Id: I6740968adec0e67c1a3e0e1a24603282a2986a8e
---
M pywikibot/__init__.py
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 80b0122..dd2b6ad 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1243,7 +1243,9 @@
# config.usernames is initialised with a defaultdict for each family name
family_name = str(fam)
- code_to_user = config.usernames['*'].copy()
+ code_to_user = {}
+ if '*' in config.usernames: # T253127: usernames is a defaultdict
+ code_to_user = config.usernames['*'].copy()
code_to_user.update(config.usernames[family_name])
user = user or code_to_user.get(code) or code_to_user.get('*')
To view, visit change 597313. To unsubscribe, or for help writing mail filters, visit settings.