XZise has uploaded a new change for review.
https://gerrit.wikimedia.org/r/247557
Change subject: [IMPROV] Yield interwiki URLs separately
......................................................................
[IMPROV] Yield interwiki URLs separately
Instead of returning one list with all URLs it can yield one URL at a time.
This way it's possible to only query the article path if nothing else matched
first.
Change-Id: Idd20f0757856299d2ae21608bb29d12c3e4cae11
---
M pywikibot/site.py
1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/57/247557/1
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 16d3e99..1c66d1e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -918,11 +918,11 @@
if self.namespaces.lookup_normalized_name(lang) is None]
def _interwiki_urls(self):
- site_paths = [self.path()] * 3
- site_paths[1] += '/'
- site_paths[2] += '?title='
- site_paths += [self.article_path]
- return site_paths
+ base_path = self.path()
+ yield base_path
+ yield base_path + '/'
+ yield base_path + '?title='
+ yield self.article_path
def interwiki(self, prefix):
"""
--
To view, visit https://gerrit.wikimedia.org/r/247557
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd20f0757856299d2ae21608bb29d12c3e4cae11
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits