jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[bugfix] Fix mul Wikisource aliases

- move '-' alias from WikimediaFamily to wikisource_family.py as it is
Wikisource-only
- merge -, mul and www Wikisource aliases
- improve code_aliases comments in WikimediaFamily
- add beta Wikiversity and its mul alias
- replace wowwiki interwiki_removals with removed_wikis
as interwiki_removals include removed_wikis automatically

Bug: T242537
Bug: T241413
Change-Id: I909eaacc570f72700b219388b92bb7582e40f152
---
M pywikibot/families/wikisource_family.py
M pywikibot/families/wikiversity_family.py
M pywikibot/families/wowwiki_family.py
M pywikibot/family.py
4 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/pywikibot/families/wikisource_family.py b/pywikibot/families/wikisource_family.py
index 11540ef..c5bb62f 100644
--- a/pywikibot/families/wikisource_family.py
+++ b/pywikibot/families/wikisource_family.py
@@ -29,7 +29,7 @@

languages_by_size = [
'pl', 'en', 'ru', 'de', 'fr', 'zh', 'he', 'it', 'es', 'ar', 'cs', 'pt',
- 'www', 'gu', 'fa', 'uk', 'hu', 'ml', 'sv', 'ko', 'sr', 'bn', 'sa',
+ 'mul', 'gu', 'fa', 'uk', 'hu', 'ml', 'sv', 'ko', 'sr', 'bn', 'sa',
'hy', 'sl', 'te', 'el', 'ro', 'fi', 'ja', 'nap', 'vi', 'ta', 'az',
'ca', 'br', 'th', 'nl', 'kn', 'hr', 'la', 'no', 'is', 'eo', 'vec',
'tr', 'pms', 'et', 'be', 'da', 'mk', 'id', 'yi', 'bg', 'li', 'mr',
@@ -65,7 +65,17 @@
cls.domains.append(cls.langs['beta'])
return cls.domains

- languages_by_size.append('mul')
+ # All requests to unknown languages are also redirected to
+ # the main page, so using mul alias, see T114574 and T241413
+ @classproperty
+ def code_aliases(cls):
+ cls.code_aliases = super(Family, cls).code_aliases.copy()
+ aliases = cls.alphabetic + ['-', 'www']
+ for code in aliases:
+ if (code not in cls.languages_by_size
+ and code not in cls.code_aliases):
+ cls.code_aliases[code] = 'mul'
+ return cls.code_aliases

# Global bot allowed languages on
# https://meta.wikimedia.org/wiki/BPI#Current_implementation
diff --git a/pywikibot/families/wikiversity_family.py b/pywikibot/families/wikiversity_family.py
index da43f46..1225a72 100644
--- a/pywikibot/families/wikiversity_family.py
+++ b/pywikibot/families/wikiversity_family.py
@@ -8,6 +8,7 @@
from __future__ import absolute_import, division, unicode_literals

from pywikibot import family
+from pywikibot.tools import classproperty


# The Wikimedia family that is known as Wikiversity
@@ -18,10 +19,18 @@
name = 'wikiversity'

languages_by_size = [
- 'de', 'en', 'fr', 'ru', 'zh', 'it', 'cs', 'beta', 'pt', 'es', 'ar',
- 'sv', 'sl', 'fi', 'el', 'hi', 'ko', 'ja',
+ 'de', 'en', 'fr', 'ru', 'zh', 'it', 'cs', 'pt', 'es', 'ar', 'sv', 'sl',
+ 'fi', 'el', 'hi', 'ko', 'ja',
]

+ test_codes = ['beta']
+
+ @classproperty
+ def code_aliases(cls):
+ cls.code_aliases = super(Family, cls).code_aliases.copy()
+ cls.code_aliases['mul'] = 'beta'
+ return cls.code_aliases
+
category_redirect_templates = {
'_default': (),
'ar': ('قالب:تحويل تصنيف',),
diff --git a/pywikibot/families/wowwiki_family.py b/pywikibot/families/wowwiki_family.py
index 10326f7..08129c9 100644
--- a/pywikibot/families/wowwiki_family.py
+++ b/pywikibot/families/wowwiki_family.py
@@ -24,7 +24,7 @@
'pt-br', 'ru', 'sk', 'tr', 'uk', 'zh', 'zh-tw'
)

- interwiki_removals = ['hr', 'ro', 'sr', 'sv']
+ removed_wikis = ['hr', 'ro', 'sr', 'sv']

@classproperty
@deprecated('codes attribute', since='20190422')
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 935ab25..9dde337 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1026,10 +1026,8 @@
if not all(x in NAME_CHARACTERS for x in cls.name):
warn('Family name %s contains non-ascii characters' % cls.name,
FamilyMaintenanceWarning)
- # FIXME: wikisource uses code '-' for www.wikisource.org
for code in cls.langs.keys():
- if not all(x in CODE_CHARACTERS for x in code) and \
- (cls.name == 'wikisource' or code[0] != '-'):
+ if not all(x in CODE_CHARACTERS for x in code):
warn('Family %s code %s contains non-ascii characters' %
(cls.name, code), FamilyMaintenanceWarning)
Family._families[fam] = cls
@@ -1658,32 +1656,28 @@
# For all except 'nl_nds', subdomains do exist as a redirect, but that
# should not be relied upon.
code_aliases = {
- # Country aliases; see T87002
- 'dk': 'da', # Wikipedia, Wikibooks and Wiktionary only.
+ # Country aliases, see T87002
+ 'dk': 'da',
'jp': 'ja',

- # Language aliases
- 'nb': 'no', # T86924
+ # Language aliases, see T86924
+ 'nb': 'no',

- # closed wiki redirection aliases
+ # Closed wiki redirection aliases
'mo': 'ro',

- # Incomplete language code change. T86915
+ # Incomplete language code change, see T86915
'minnan': 'zh-min-nan',
'nan': 'zh-min-nan',

- # These two probably only apply to Wikipedia.
- # Server not found for the other projects.
'zh-tw': 'zh',
'zh-cn': 'zh',

- # miss-spelling
+ # Miss-spelling
'nl_nds': 'nl-nds',

- # Renamed; see T11823
+ # Renamed, see T11823
'be-x-old': 'be-tarask',
-
- '-': 'mul', # T114574
}

# Not open for edits; stewards can still edit.

To view, visit change 573992. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I909eaacc570f72700b219388b92bb7582e40f152
Gerrit-Change-Number: 573992
Gerrit-PatchSet: 24
Gerrit-Owner: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Mpaa <mpaa.wiki@gmail.com>