jenkins-bot has submitted this change and it was merged.
Change subject: calculating crossnamespace from authornamespaces, update from core 86085 ......................................................................
calculating crossnamespace from authornamespaces, update from core 86085
Change-Id: I25b4aaf659c2c7f442bfafb6904761897397f3ee --- M families/wikisource_family.py M family.py 2 files changed, 5 insertions(+), 46 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/families/wikisource_family.py b/families/wikisource_family.py index c7bd9ed..1fa8ec5 100644 --- a/families/wikisource_family.py +++ b/families/wikisource_family.py @@ -717,48 +717,6 @@ 'zh': [102], }
- self.crossnamespace[0] = { - '_default': self.authornamespaces, - } - self.crossnamespace[100] = { - 'bg': self.authornamespaces, - 'cs': self.authornamespaces, - 'hr': self.authornamespaces, - 'hu': self.authornamespaces, - 'hy': self.authornamespaces, - 'ko': self.authornamespaces, - 'tr': self.authornamespaces, - } - - self.crossnamespace[102] = { - 'ar': self.authornamespaces, - 'be': self.authornamespaces, - 'da': self.authornamespaces, - 'en': self.authornamespaces, - 'eo': self.authornamespaces, - 'fa': self.authornamespaces, - 'fr': self.authornamespaces, - 'it': self.authornamespaces, - 'la': self.authornamespaces, - 'nl': self.authornamespaces, - 'no': self.authornamespaces, - 'pt': self.authornamespaces, - 'ro': self.authornamespaces, - 'vi': self.authornamespaces, - 'zh': self.authornamespaces, - } - - self.crossnamespace[104] = { - 'pl': self.authornamespaces, - } - - self.crossnamespace[106] = { - 'ca': self.authornamespaces, - 'et': self.authornamespaces, - 'sv': self.authornamespaces, - } - - self.crossnamespace[108] = { - 'he': self.authornamespaces, - } - + for key, values in self.authornamespaces.iteritems(): + for item in values: + self.crossnamespace[item].update({key: self.authornamespaces}) diff --git a/family.py b/family.py index ac4ba46..77151b5 100644 --- a/family.py +++ b/family.py @@ -10,6 +10,7 @@ import re import urllib from datetime import timedelta, datetime +import collections
import config import wikipedia as pywikibot @@ -3881,7 +3882,7 @@ # values are dicts where: # keys are the languages that can be linked to from the lang+ns, or # '_default'; values are a list of namespace numbers - self.crossnamespace = {} + self.crossnamespace = collections.defaultdict(dict) ## ## Examples : ## Allowing linking to pt' 102 NS from any other lang' 0 NS is