Xqt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/104193
Change subject: Keep track of selected options.
......................................................................
Keep track of selected options.
Single-selected options may be used for different edit summaries
e.g. for delete.py or protect.py etc.
Change-Id: I1001110571f8f7d6d8bfd1b88538dcdba4057288
---
M pywikibot/pagegenerators.py
1 file changed, 26 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/93/104193/1
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 2801746..1b46b51 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -192,12 +192,30 @@
This factory is responsible for processing command line arguments
that are used by many scripts and that determine which pages to work on.
"""
+
+ generator_options = ( # a list of all generators except filters
+ 'filelinks', 'unusedfiles', 'unwatched', 'usercontribs',
+ 'withoutinterwiki', 'interwiki', 'randomredirect', 'random',
+ 'recentchanges', 'file', 'catr', 'cat', 'category', 'subcatsr',
+ 'subcats', 'page', 'uncatfiles', 'uncatcat', 'uncat', 'ref', 'links',
+ 'weblink', 'transcludes', 'start', 'prefixindex', 'newimages',
+ 'newpages', 'imagesused', 'search', 'google', 'yahoo', 'untagged'
+ )
+
def __init__(self):
self.gens = []
self.namespaces = []
self.step = None
self.limit = None
self.articlefilter = None
+ self.__option = []
+
+ @property
+ def option(self):
+ if len(self.__option) > 1:
+ pass
+ elif len(self.__option) == 1:
+ return self.__option[0]
def getCombinedGenerator(self):
"""Return the combination of all accumulated generators.
@@ -488,10 +506,15 @@
gen = YahooSearchPageGenerator(arg[7:])
elif arg.startswith('-untagged'):
gen = UntaggedPageGenerator(arg[10:])
- else:
- pass
+
if gen:
self.gens.append(gen)
+ # fill selected generator options
+ index = arg.find(':')
+ option = arg[1:] if index < 0 else arg[1:index]
+ if option and option in self.generator_options:
+ self.__option.append(option)
+ print len(self.gens)
return True
else:
return False
@@ -1043,7 +1066,7 @@
"""
URL = "http://toolserver.org/~daniel/WikiSense/UntaggedImages.php?"
REGEXP = r"<td valign='top' title='Name'><a href='http://.*?" \
- "\.org/w/index\.php\?title=(.*?)'>.*?</a></td>"
+ "\.org/w/index\.php\?title=(.*?)'>.*?</a></td>"
lang, project = untaggedProject.split('.', 1)
if lang == 'commons':
wiki = 'wikifam=commons.wikimedia.org'
--
To view, visit https://gerrit.wikimedia.org/r/104193
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1001110571f8f7d6d8bfd1b88538dcdba4057288
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