jenkins-bot submitted this change.

View Change

Approvals: Meno25: Looks good to me, approved jenkins-bot: Verified
FEAT] skip InvalidPageError in cosmetic_changes.py

Bug: T293612
Change-Id: I860ae159c9ab4a5dc8f853f22a44dbd9f45b9626
---
M scripts/cosmetic_changes.py
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index d4e931d..d7d4c04 100755
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -44,6 +44,7 @@
NoRedirectPageBot,
)
from pywikibot.cosmetic_changes import CANCEL, CosmeticChangesToolkit
+from pywikibot.exceptions import InvalidPageError


warning = """
@@ -72,12 +73,22 @@
}

def treat_page(self) -> None:
- """Treat page with the cosmetic toolkit."""
+ """Treat page with the cosmetic toolkit.
+
+ .. versionchanged:: 7.0
+ skip if InvalidPageError is raised
+ """
cc_toolkit = CosmeticChangesToolkit(self.current_page,
ignore=self.opt.ignore)
- changed_text = cc_toolkit.change(self.current_page.text)
- if changed_text is not False:
- self.put_current(new_text=changed_text,
+ try:
+ old_text = self.current_page.text
+ except InvalidPageError:
+ pywikibot.exception()
+ return
+
+ new_text = cc_toolkit.change(old_text)
+ if new_text is not False:
+ self.put_current(new_text=new_text,
summary=self.opt.summary,
asynchronous=self.opt['async'])


To view, visit change 735929. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I860ae159c9ab4a5dc8f853f22a44dbd9f45b9626
Gerrit-Change-Number: 735929
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Meno25 <meno25mail@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged