Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328306?usp=email )

Change subject: solve_disambiguation: Reuse summary page title
......................................................................

solve_disambiguation: Reuse summary page title

Resolve the disambiguation page title once when building an edit summary.
Reuse it across customized, redirect, unlink, and template summary branches.

Change-Id: I08f7cc26ca874712e5385cdd0da99e655b59ac99
---
M scripts/solve_disambiguation.py
1 file changed, 10 insertions(+), 8 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Verified; Looks good to me, approved




diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 6ab9b17..932f425 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -1131,6 +1131,8 @@
             targets = i18n.twtranslate(self.site,
                                        'solve_disambiguation-unknown-page')

+        page_title = page.title()
+
         # first check whether user has customized the edit comment
         if (self.site.family.name in config.disambiguation_comment
                 and self.site.lang in config.disambiguation_comment[
@@ -1139,7 +1141,7 @@
                 self.summary = i18n.translate(
                     self.site,
                     config.disambiguation_comment[self.site.family.name],
-                    fallback=True) % (page.title(), targets)
+                    fallback=True) % (page_title, targets)

             # Backwards compatibility, type error probably caused by too
             # many arguments for format string
@@ -1147,39 +1149,39 @@
                 self.summary = i18n.translate(
                     self.site,
                     config.disambiguation_comment[self.site.family.name],
-                    fallback=True) % page.title()
+                    fallback=True) % page_title
         elif page.isRedirectPage():
             # when working on redirects, there's another summary message
             if unlink_counter and not new_targets:
                 self.summary = i18n.twtranslate(
                     self.site,
                     'solve_disambiguation-redirect-removed',
-                    {'from': page.title(),
+                    {'from': page_title,
                      'count': unlink_counter})
             elif dn and not new_targets:
                 self.summary = i18n.twtranslate(
                     self.site,
                     'solve_disambiguation-redirect-adding-dn-template',
-                    {'from': page.title()})
+                    {'from': page_title})
             else:
                 self.summary = i18n.twtranslate(
                     self.site, 'solve_disambiguation-redirect-resolved',
-                    {'from': page.title(),
+                    {'from': page_title,
                      'to': targets,
                      'count': len(new_targets)})
         elif unlink_counter and not new_targets:
             self.summary = i18n.twtranslate(
                 self.site, 'solve_disambiguation-links-removed',
-                {'from': page.title(),
+                {'from': page_title,
                  'count': unlink_counter})
         elif dn and not new_targets:
             self.summary = i18n.twtranslate(
                 self.site, 'solve_disambiguation-adding-dn-template',
-                {'from': page.title()})
+                {'from': page_title})
         else:
             self.summary = i18n.twtranslate(
                 self.site, 'solve_disambiguation-links-resolved',
-                {'from': page.title(),
+                {'from': page_title,
                  'to': targets,
                  'count': len(new_targets)})


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1328306?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: I08f7cc26ca874712e5385cdd0da99e655b59ac99
Gerrit-Change-Number: 1328306
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: RhinosF1 <[email protected]>
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to