jenkins-bot has submitted this change and it was merged.
Change subject: Use Page.touch() for touch script ......................................................................
Use Page.touch() for touch script
Page.touch() does not add pages to user's watchlist
Also remove -redir parameter which is no longer supported
bug: T69528 Change-Id: I771bd536cd3c9dd7383d8ecf24e72f630945e58c --- M scripts/touch.py 1 file changed, 4 insertions(+), 14 deletions(-)
Approvals: XZise: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/touch.py b/scripts/touch.py index 359d320..286d091 100755 --- a/scripts/touch.py +++ b/scripts/touch.py @@ -12,8 +12,6 @@
-purge Do not touch but purge the page
--redir specifies that the bot should work on redirect pages; - otherwise, they will be skipped. Cannot be used with -purge. """ # # (C) Pywikibot team, 2009-2015 @@ -37,26 +35,15 @@
def __init__(self, generator, **kwargs): """Initialize a TouchBot instance with the options and generator.""" - self.availableOptions.update({ - 'redir': False, # include redirect pages - }) - super(TouchBot, self).__init__(generator=generator, **kwargs)
def treat(self, page): """Touch the given page.""" try: - # get the page, and save it using the unmodified text. - # whether or not getting a redirect throws an exception - # depends on the variable self.touch_redirects. - page.get(get_redirect=self.getOption('redir')) - page.save("Pywikibot touch script") + page.touch() except pywikibot.NoPage: pywikibot.error(u"Page %s does not exist." % page.title(asLink=True)) - except pywikibot.IsRedirectPage: - pywikibot.warning(u"Page %s is a redirect; skipping." - % page.title(asLink=True)) except pywikibot.LockedPage: pywikibot.error(u"Page %s is locked." % page.title(asLink=True)) @@ -96,6 +83,9 @@ for arg in local_args: if arg == '-purge': bot_class = PurgeBot + elif arg == '-redir': + pywikibot.output(u'-redirect option is deprecated, ' + 'do not use it anymore.') elif not genFactory.handleArg(arg) and arg.startswith("-"): options[arg[1:].lower()] = True
pywikibot-commits@lists.wikimedia.org