jenkins-bot has submitted this change and it was merged.
Change subject: touch.py: allow botflag tagging from cli ......................................................................
touch.py: allow botflag tagging from cli
Allow the operator to choose to use the 'b' flag.
Bug: T113450 Change-Id: I81c075ef14ad7c46917e138fb2be2aa248a74b54 --- M pywikibot/page.py M scripts/touch.py 2 files changed, 11 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py index 7f949fe..e296248 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -1213,12 +1213,14 @@ """ return self.site.purgepages([self], **kwargs)
- def touch(self, callback=None, **kwargs): + def touch(self, callback=None, botflag=False, **kwargs): """Make a touch edit for this page.
See save() method docs for all parameters. The following parameters will be overridden by this method: - summary, watch, minor, botflag, force, async + - summary, watch, minor, force, async + + Parameter botflag is False by default.
minor and botflag parameters are set to False which prevents hiding the edit when it becomes a real edit due to a bug. @@ -1227,7 +1229,7 @@ # ensure always get the page text and not to change it. del self.text self.save(summary='Pywikibot touch edit', watch='nochange', - minor=False, botflag=False, force=True, async=False, + minor=False, botflag=botflag, force=True, async=False, callback=callback, apply_cosmetic_changes=False, **kwargs) else: diff --git a/scripts/touch.py b/scripts/touch.py index ccf92bf..c9162e2 100755 --- a/scripts/touch.py +++ b/scripts/touch.py @@ -11,6 +11,7 @@ ¶ms;
-purge Do not touch but purge the page +-botflag Force botflag in case of edits with changes.
""" # @@ -36,12 +37,15 @@
def __init__(self, generator, **kwargs): """Initialize a TouchBot instance with the options and generator.""" + self.availableOptions.update({ + 'botflag': False, + }) super(TouchBot, self).__init__(generator=generator, **kwargs)
def treat(self, page): """Touch the given page.""" try: - page.touch() + page.touch(botflag=self.getOption('botflag')) except pywikibot.NoPage: pywikibot.error(u"Page %s does not exist." % page.title(asLink=True)) @@ -88,6 +92,7 @@ pywikibot.output(u'-redirect option is deprecated, ' 'do not use it anymore.') elif not genFactory.handleArg(arg) and arg.startswith("-"): + # -botflag options[arg[1:].lower()] = True
gen = genFactory.getCombinedGenerator()
pywikibot-commits@lists.wikimedia.org