Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173665
Change subject: [FEAT] Process a single page with redirect.py
......................................................................
[FEAT] Process a single page with redirect.py
Additional -page option enables to work on a single page to solve
it's problems.
Change-Id: I6e7da9ba91c7eb820b10b07a77076a093a2c2b2a
---
M scripts/redirect.py
1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/65/173665/1
diff --git a/scripts/redirect.py b/scripts/redirect.py
index c39a931..87cd3d0 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -82,7 +82,7 @@
def __init__(self, xmlFilename=None, namespaces=[], offset=-1,
use_move_log=False, use_api=False, start=None, until=None,
- number=None, step=None):
+ number=None, step=None, page=None):
self.site = pywikibot.Site()
self.xmlFilename = xmlFilename
self.namespaces = namespaces
@@ -95,6 +95,7 @@
self.api_until = until
self.api_number = number
self.api_step = step
+ self.page = page
def get_redirects_from_dump(self, alsoGetPageTitles=False):
"""
@@ -267,6 +268,8 @@
count += 1
if count >= self.api_number:
break
+ elif self.page:
+ yield self.page
elif not self.xmlFilename:
# retrieve information from broken redirect special page
pywikibot.output(u'Retrieving special page...')
@@ -326,6 +329,8 @@
yield key
pywikibot.output(u'\nChecking redirect %i of %i...'
% (num + 1, len(redict)))
+ elif self.page:
+ yield self.page
else:
# retrieve information from double redirect special page
pywikibot.output(u'Retrieving special page...')
@@ -753,6 +758,8 @@
until = ''
number = None
step = None
+ pagename = None
+
for arg in pywikibot.handle_args(args):
if arg == 'double' or arg == 'do':
action = 'double'
@@ -796,6 +803,8 @@
number = int(arg[7:])
elif arg.startswith('-step:'):
step = int(arg[6:])
+ elif arg.startswith('-page:'):
+ pagename = arg[6:]
elif arg == '-always':
options['always'] = True
elif arg == '-delete':
@@ -812,7 +821,7 @@
else:
pywikibot.Site().login()
gen = RedirectGenerator(xmlFilename, namespaces, offset, moved_pages,
- fullscan, start, until, number, step)
+ fullscan, start, until, number, step, pagename)
bot = RedirectRobot(action, gen, number=number, **options)
bot.run()
--
To view, visit https://gerrit.wikimedia.org/r/173665
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e7da9ba91c7eb820b10b07a77076a093a2c2b2a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits