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

Change subject: archivebot: Join discussion page fragments
......................................................................

archivebot: Join discussion page fragments

Collect the normalized header and rendered threads, then join them when
assigning the page text. This avoids repeated string concatenation as
archive and discussion pages grow, particularly on PyPy.

Preserve thread ordering, header newlines, edit summaries and save options.

Change-Id: I765721013bef7194e888fb1fc3e1cb56c34213b5
---
M scripts/archivebot.py
1 file changed, 3 insertions(+), 4 deletions(-)

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




diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 8665970..979ea68 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -583,13 +583,12 @@
         if sort_threads:
             self.archiver.info('Sorting threads...')
             self.threads.sort(key=lambda t: t.timestamp)
-        newtext = self.header.strip() + '\n\n'  # Fix trailing newlines
-        for t in self.threads:
-            newtext += t.to_text()
+        page_text = [self.header.strip() + '\n\n']  # Fix trailing newlines
+        page_text.extend(t.to_text() for t in self.threads)
         if self.full:
             summary += ' ' + i18n.twtranslate(self.site.code,
                                               'archivebot-archive-full')
-        self.text = newtext
+        self.text = ''.join(page_text)
         self.save(summary, asynchronous=asynchronous)



--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1345315?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: I765721013bef7194e888fb1fc3e1cb56c34213b5
Gerrit-Change-Number: 1345315
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]

Reply via email to