jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/789552 )
Change subject: [IMPR] Add a -nopreload option to replace.py
......................................................................
[IMPR] Add a -nopreload option to replace.py
Wikis might have preloading pages disabled. To reflect this a new
-nopreload option was added to disable preloading pages within generator
See:
https://lotro-wiki.com/index.php/User:Magill-bot#Usage_Explanation
Change-Id: Icfd0442bebb1b39ff8b72533deadbc85e172fa76
---
M scripts/replace.py
1 file changed, 6 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py
index 6d807db..0ba7a01 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -93,6 +93,8 @@
-quiet Don't prompt a message if a page keeps unchanged
+-nopreload Do not preload pages. Usefull if disabled on a wiki.
+
-recursive Recurse replacement as long as possible. Be careful, this
might lead to an infinite loop.
@@ -892,6 +894,7 @@
edit_summary = ''
# Array which will collect commandline parameters.
# First element is original text, second element is replacement text.
+ preload = False # preload pages
commandline_replacements = []
file_replacements = []
# A list of 2-tuples of original text and replacement text.
@@ -952,6 +955,8 @@
manual_input = True
elif opt == '-pairsfile':
file_replacements = handle_pairsfile(value)
+ elif opt == '-nopreload':
+ preload = False
else:
commandline_replacements.append(arg)
@@ -1087,7 +1092,7 @@
# exceptions are taken into account by the ReplaceRobot
gen = handle_sql(sql_query, replacements, exceptions['text-contains'])
- gen = genFactory.getCombinedGenerator(gen, preload=True)
+ gen = genFactory.getCombinedGenerator(gen, preload=preload)
if pywikibot.bot.suggest_help(missing_generator=not gen):
return
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/789552
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Icfd0442bebb1b39ff8b72533deadbc85e172fa76
Gerrit-Change-Number: 789552
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged