John Vandenberg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/205991
Change subject: Fix Site loading without an explicit family
......................................................................
Fix Site loading without an explicit family
Change-Id: Ia6696de8f7718e1e48b6186035349c786459495b
---
M pywikibot/textlib.py
M scripts/interwiki.py
2 files changed, 12 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/91/205991/1
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 530dc70..f7a8da6 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -624,11 +624,15 @@
def interwikiFormat(links, insite=None):
"""Convert interwiki link dict into a wikitext string.
- 'links' should be a dict with the Site objects as keys, and Page
- or Link objects as values.
-
- Return a unicode string that is formatted for inclusion in insite
- (defaulting to the current site).
+ @param links: interwiki links to be formatted
+ @type links: dict with the Site objects as keys, and Page
+ or Link objects as values.
+ @param insite: site the interwiki links will be formatted for
+ (defaulting to the current site).
+ @type insite: BaseSite
+ @return: string including wiki links formatted for inclusion
+ in insite
+ @rtype: unicode
"""
if insite is None:
insite = pywikibot.Site()
@@ -644,7 +648,8 @@
link = title.replace('[[:', '[[')
s.append(link)
except AttributeError:
- s.append(pywikibot.Site(code=site).linkto(links[site],
othersite=insite))
+ s.append(pywikibot.Site(site, insite.family).linkto(
+ links[site], othersite=insite))
if insite.lang in insite.family.interwiki_on_one_line:
sep = u' '
else:
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 396a085..cafbbbc 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1680,7 +1680,7 @@
frgnSiteDone = False
for siteCode in lclSite.family.languages_by_size:
- site = pywikibot.Site(siteCode)
+ site = pywikibot.Site(siteCode, lclSite.family)
if (not lclSiteDone and site == lclSite) or \
(not frgnSiteDone and site != lclSite and site in new):
if site == lclSite:
--
To view, visit https://gerrit.wikimedia.org/r/205991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6696de8f7718e1e48b6186035349c786459495b
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