http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11693
Revision: 11693 Author: xqt Date: 2013-06-24 16:57:24 +0000 (Mon, 24 Jun 2013) Log Message: ----------- eol-style native
Modified Paths: -------------- branches/rewrite/scripts/harvest_template.py
Property Changed: ---------------- branches/rewrite/scripts/harvest_template.py
Modified: branches/rewrite/scripts/harvest_template.py =================================================================== --- branches/rewrite/scripts/harvest_template.py 2013-06-24 16:55:46 UTC (rev 11692) +++ branches/rewrite/scripts/harvest_template.py 2013-06-24 16:57:24 UTC (rev 11693) @@ -8,7 +8,7 @@
Usage:
-python harvest_template.py -lang:nl -template:"Taxobox straalvinnige" orde P70 familie P71 geslacht P74 +python harvest_template.py -lang:nl -template:"Taxobox straalvinnige" orde P70 familie P71 geslacht P74
This will work on all pages that transclude the template in the article namespace
@@ -41,7 +41,7 @@ self.repo = pywikibot.Site().data_repository() self.source = None self.setSource(pywikibot.Site().language()) - + def setSource(self, lang): ''' Get the source @@ -51,7 +51,7 @@ source_values = source_values['wikipedia'] for lang in source_values: source_values[lang] = pywikibot.ItemPage(self.repo, source_values[lang]) - + if lang in source_values: self.source = pywikibot.Claim(self.repo, 'p143') self.source.setTarget(source_values.get(lang)) @@ -128,7 +128,7 @@ continue else: commandline_arguments.append(arg) - + if len(commandline_arguments) % 2 or not templateTitle: raise ValueError # or something. fields = dict() @@ -140,7 +140,7 @@ if not generator: # TODO: Build a transcluding generator based on templateTitle return - + bot = HarvestRobot(generator, templateTitle, fields) bot.run()
Property changes on: branches/rewrite/scripts/harvest_template.py ___________________________________________________________________ Added: svn:eol-style + native
pywikipedia-svn@lists.wikimedia.org