Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328314?usp=email )
Change subject: interwiki: Reuse disambiguation states
......................................................................
interwiki: Reuse disambiguation states
Resolve the origin and linked page disambiguation states once. Reuse them
across autonomous and interactive mismatch handling.
Change-Id: I51b5ffebb8e2e71cd7061084d9dcf94d855241ba
---
M scripts/interwiki.py
1 file changed, 7 insertions(+), 4 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 80e0670..49570a1 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -948,15 +948,18 @@
if not self.origin:
return (False, None) # any page matches til we have an origin page
+ origin_disambig = self.origin.isDisambig()
+ page_disambig = page.isDisambig()
+
if self.conf.autonomous:
- if self.origin.isDisambig() and not page.isDisambig():
+ if origin_disambig and not page_disambig:
pywikibot.info(
'NOTE: Ignoring link from disambiguation page '
f'{self.origin} to non-disambiguation {page}'
)
return (True, None)
- if not self.origin.isDisambig() and page.isDisambig():
+ if not origin_disambig and page_disambig:
pywikibot.info(
'NOTE: Ignoring link from non-disambiguation page '
f'{self.origin} to disambiguation {page}'
@@ -965,7 +968,7 @@
else:
choice = 'y'
- if self.origin.isDisambig() and not page.isDisambig():
+ if origin_disambig and not page_disambig:
disambig = self.getFoundDisambig(page.site)
if disambig:
pywikibot.info(
@@ -983,7 +986,7 @@
automatic_quit=False
)
- elif not self.origin.isDisambig() and page.isDisambig():
+ elif not origin_disambig and page_disambig:
nondisambig = self.getFoundNonDisambig(page.site)
if nondisambig:
pywikibot.info(
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328314?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I51b5ffebb8e2e71cd7061084d9dcf94d855241ba
Gerrit-Change-Number: 1328314
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]