jenkins-bot has submitted this change and it was merged.

Change subject: Make parsing site's parameters resistant to broken namespace 
alias
......................................................................


Make parsing site's parameters resistant to broken namespace alias

Bug: T151146
Change-Id: I917caec8f5e78a80c221c941e71feb86861b401c
---
M pywikibot/site.py
1 file changed, 8 insertions(+), 2 deletions(-)

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



diff --git a/pywikibot/site.py b/pywikibot/site.py
index f4267ca..4e8b6e1 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2635,8 +2635,14 @@
 
         for item in self.siteinfo.get('namespacealiases'):
             ns = int(item['id'])
-            if item['*'] not in _namespaces[ns]:
-                _namespaces[ns].aliases.append(item['*'])
+            try:
+                namespace = _namespaces[ns]
+            except KeyError:
+                pywikibot.warning(
+                    'Broken namespace alias "{0}" (id: {1}) on {2}'.format(
+                        item['*'], item['id'], self))
+            if item['*'] not in namespace:
+                namespace.aliases.append(item['*'])
 
         return _namespaces
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I917caec8f5e78a80c221c941e71feb86861b401c
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Magul <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Lokal Profil <[email protected]>
Gerrit-Reviewer: Magul <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to