jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1306040?usp=email )

Change subject: interwiki: respect usernames wildcards
......................................................................

interwiki: respect usernames wildcards

Bug: T430362
Change-Id: I1b99b05aab9e49d297e07252445d43490f8c835a
---
M scripts/interwiki.py
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 0d448e2..3dbcb07 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -343,6 +343,8 @@
 .. version-changed:: 11.3
    The ``-new`` option was removed in favour of pagegenerators
    ``-newpages``.
+.. version-changed:: 11.5
+   Wildcards (``'*'``) in :mod:`config.usernames<config>` are now respected.
 """
 from __future__ import annotations

@@ -1489,8 +1491,9 @@
                or (not frgnSiteDone and site != lclSite and site in new):
                 if site == lclSite:
                     lclSiteDone = True   # even if we fail the update
-                if (site.family.name in config.usernames
-                        and site.code in config.usernames[site.family.name]):
+
+                codes = config.usernames.get(site.family.name, {})
+                if codes and site.code in codes or '*' in codes:
                     try:
                         if self.replaceLinks(new[site], new):
                             updated.append(site)
@@ -1536,9 +1539,9 @@
                 )
                 continue

-            # Check if a username is configured for this site
+            # Check if a username or wildcard is configured for this site
             codes = config.usernames.get(site.family.name, [])
-            if site.code not in codes:
+            if site.code not in codes and '*' not in codes:
                 pywikibot.warning(
                     f'username for {site} is not given in your user-config.py'
                 )

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1306040?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1b99b05aab9e49d297e07252445d43490f8c835a
Gerrit-Change-Number: 1306040
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Ivan-r <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to