Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/287096
Change subject: [IMPR] Improvements for interwikidata.py ...................................................................... [IMPR] Improvements for interwikidata.py - Add doc for already implemented options -ignore_ns and -summary. - Align explanation to the same column like for -help documentation - Add additional TODO hint (a separate phab task will be done). - fallback is enabled by default for i18n.twtranslate - Simplify arg parsing. Change-Id: I5a1629c4708a4c08898dc5f50977512859e6157e --- M scripts/interwikidata.py 1 file changed, 18 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/96/287096/1 diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py index 1d3c1f3..01b7989 100644 --- a/scripts/interwikidata.py +++ b/scripts/interwikidata.py @@ -14,12 +14,18 @@ Furthermore, the following command line parameters are supported: --clean Clean pages. +-clean Clean pages. --create Create items only. +-create Create items only. + +-ignore_ns Ignore namespace warning and try to submit unsupported + namespaces to wikidata. + NOTE: This is on your own risk! + +-summary: Use your own edit summary for cleaning the page. """ -# (C) Pywikibot team, 2015 +# (C) Pywikibot team, 2015-2016 # # Distributed under the terms of the MIT license. # @@ -42,7 +48,7 @@ # Allowed namespaces. main, project, template, category namespaces = [0, 4, 10, 14] -# TODO: Some templates on pages, like csd and afd templates, +# TODO: Some templates on pages, like csd, note and afd templates, # should cause the bot to skip the page @@ -66,7 +72,7 @@ self.repo = site.data_repository() if not self.getOption('summary'): self.options['summary'] = pywikibot.i18n.twtranslate( - site, 'interwikidata-clean-summary', fallback=True) + site, 'interwikidata-clean-summary') def treat_page(self): """Check page.""" @@ -181,25 +187,21 @@ @type args: list of unicode """ generator = None - clean = False - create = False - always = False local_args = pywikibot.handle_args(args) genFactory = pagegenerators.GeneratorFactory() options = {} for arg in local_args: - if arg == '-clean': - clean = True - elif arg == '-create': - create = True - elif arg.startswith('-always'): - always = True + option, sep, value = arg.partition(':') + option = option[1:] if option.startswith('-') else None + if genFactory.handleArg(arg): + continue + if option == 'summary': + options[option] = value else: - genFactory.handleArg(arg) + options[option] = True site = pywikibot.Site() - options = {'always': always, 'create': create, 'clean': clean} if not generator: generator = genFactory.getCombinedGenerator() if generator: -- To view, visit https://gerrit.wikimedia.org/r/287096 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a1629c4708a4c08898dc5f50977512859e6157e Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits