jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Site: Only store complete mapping
......................................................................
[FIX] Site: Only store complete mapping
If the site is interrupted while loading the namespaces the stored
namespaces might be invalid/incomplete. This buffers the namespaces and
only stores it after the mapping has been build.
Bug: 73122
Change-Id: I64418dca1b66418dfb893b83f8d141b372bd2380
---
M pywikibot/site.py
1 file changed, 6 insertions(+), 4 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 8cf9f60..b167707 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2011,7 +2011,7 @@
return self.getmagicwords("pagenamee")
def _build_namespaces(self):
- self._namespaces = SelfCallDict()
+ _namespaces = SelfCallDict()
# In MW 1.14, API siprop 'namespaces' added 'canonical',
# and Image became File with Image as an alias.
@@ -2034,12 +2034,14 @@
namespace = Namespace(ns, canonical_name, custom_name,
use_image_name=not is_mw114,
**nsdata)
- self._namespaces[ns] = namespace
+ _namespaces[ns] = namespace
for item in self.siteinfo.get('namespacealiases'):
ns = int(item['id'])
- if item['*'] not in self._namespaces[ns]:
- self._namespaces[ns].aliases.append(item['*'])
+ if item['*'] not in _namespaces[ns]:
+ _namespaces[ns].aliases.append(item['*'])
+
+ self._namespaces = _namespaces
@need_version("1.14")
@deprecated("has_extension")
--
To view, visit https://gerrit.wikimedia.org/r/171815
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I64418dca1b66418dfb893b83f8d141b372bd2380
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits