jenkins-bot submitted this change.
[IMPR] Remove _replace_sync_callback in replace.py
There is no reason to have a callback function for synchroneous
page save which in result does just nothing except preventing
showing the page save message and does a bulk save message
every 50 titles. Use the default Bot behaviour instead.
Change-Id: Icf4fa26727207aa7d52818be019055c0a42acf89
---
M scripts/replace.py
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/scripts/replace.py b/scripts/replace.py
index e9f1d68..321317b 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -666,7 +666,7 @@
new_text = self.apply_replacements(original_text, set(), page=page)
return new_text
- def _log_changes(self, page, err):
+ def _replace_async_callback(self, page, err):
"""Log changed titles for display."""
# This is an async put callback
if not isinstance(err, Exception):
@@ -676,16 +676,6 @@
self._pending_processed_titles.put((page.title(as_link=True),
False))
- def _replace_async_callback(self, page, err):
- """Callback for asynchronous page edit."""
- self._log_changes(page, err)
-
- def _replace_sync_callback(self, page, err):
- """Callback for synchronous page edit."""
- self._log_changes(page, err)
- if isinstance(err, Exception):
- raise err
-
def generate_summary(self, applied_replacements):
"""Generate a summary message for the replacements."""
# all replacements which are merged into the default message
@@ -816,15 +806,7 @@
if self.getOption('always') and new_text != original_text:
self.save(page, original_text, new_text, applied,
- show_diff=False, quiet=True,
- callback=self._replace_sync_callback,
- asynchronous=False)
- if self._pending_processed_titles.qsize() > 50:
- while not self._pending_processed_titles.empty():
- proc_title, res = self._pending_processed_titles.get()
- pywikibot.output('Page {0}{1} saved'
- .format(proc_title,
- '' if res else ' not'))
+ show_diff=False, asynchronous=False)
def save(self, page, oldtext, newtext, applied, **kwargs):
"""Save the given page."""
To view, visit change 591940. To unsubscribe, or for help writing mail filters, visit settings.