John Vandenberg has uploaded a new change for review.

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

Change subject: Namespaces initialisation bug
......................................................................

Namespaces initialisation bug

is_mw114 is set to be True for sites with mediawiki >= 1.14.
Those sites use Image namespace, rather than File.  The boolean
needs to be reversed.

Also, when adding aliases, do not add an alias if it is already
in the object.

Change-Id: Id85dea19554450f387c13f68f73ae54eeeaf941c
---
M pywikibot/site.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/43/152843/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 060776b..47d170d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1490,7 +1490,7 @@
             # Remove the 'id' from nsdata
             nsdata[nskey].pop('id')
             namespace = Namespace(ns, canonical_name, custom_name,
-                                  use_image_name=is_mw114, **nsdata[nskey])
+                                  use_image_name=not is_mw114, **nsdata[nskey])
 
             self._namespaces[ns] = namespace
 
@@ -1498,7 +1498,8 @@
             aliasdata = sidata['namespacealiases']
             for item in aliasdata:
                 ns = int(item['id'])
-                self._namespaces[ns].aliases.append(item['*'])
+                if item['*'] not in self._namespaces[ns]:
+                    self._namespaces[ns].aliases.append(item['*'])
 
         if 'extensions' in sidata:
             self._extensions = sidata['extensions']

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

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

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

Reply via email to