jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340523?usp=email )

Change subject: Reuse the database name when creating item sitelinks
......................................................................

Reuse the database name when creating item sitelinks

Read the page site's database name once and reuse it for the sitelink
key and site field. Avoid the duplicate dbName() call when constructing
the item data.

Change-Id: I7397f662ffe0a5e087bb100f2f4637ad072d5c85
---
M pywikibot/bot.py
1 file changed, 3 insertions(+), 2 deletions(-)

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




diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index f724ddf..879d253 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -2257,9 +2257,10 @@

         if data is None:
             data = {}
+        db_name = page.site.dbName()
         data.setdefault('sitelinks', {}).update({
-            page.site.dbName(): {
-                'site': page.site.dbName(),
+            db_name: {
+                'site': db_name,
                 'title': page.title()
             }
         })

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

Reply via email to