http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9548
Revision: 9548 Author: xqt Date: 2011-09-25 13:33:27 +0000 (Sun, 25 Sep 2011) Log Message: ----------- update touch.py trunk release from rewrite and vice versa
Modified Paths: -------------- branches/rewrite/scripts/touch.py trunk/pywikipedia/touch.py
Modified: branches/rewrite/scripts/touch.py =================================================================== --- branches/rewrite/scripts/touch.py 2011-09-25 12:31:38 UTC (rev 9547) +++ branches/rewrite/scripts/touch.py 2011-09-25 13:33:27 UTC (rev 9548) @@ -46,17 +46,17 @@ text = page.get(get_redirect = self.touch_redirects) page.save("Pywikibot touch script") except pywikibot.NoPage: - pywikibot.error(u"Page %s does not exist" - % page.title(asLink=True)) + 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)) + % page.title(asLink=True)) except pywikibot.LockedPage: - pywikibot.error(u"Page %s is locked" - % page.title(asLink=True)) + pywikibot.error(u"Page %s is locked." + % page.title(asLink=True)) except pywikibot.PageNotSaved: - pywikibot.error(u"Page %s not saved" - % page.title(asLink=True)) + pywikibot.error(u"Page %s not saved." + % page.title(asLink=True))
def main(*args):
Modified: trunk/pywikipedia/touch.py =================================================================== --- trunk/pywikipedia/touch.py 2011-09-25 12:31:38 UTC (rev 9547) +++ trunk/pywikipedia/touch.py 2011-09-25 13:33:27 UTC (rev 9548) @@ -44,17 +44,22 @@ # whether or not getting a redirect throws an exception # depends on the variable self.touch_redirects. text = page.get(get_redirect = self.touch_redirects) - page.put(text) + page.put(text, "Pywikibot touch script") except pywikibot.NoPage: - pywikibot.output(u"Page %s does not exist?!" % page.aslink()) + pywikibot.output(u"Page %s does not exist." + % page.title(asLink=True)) except pywikibot.IsRedirectPage: - pywikibot.output(u"Page %s is a redirect; skipping." % page.aslink()) + pywikibot.output(u"Page %s is a redirect; skipping." + % page.title(asLink=True)) except pywikibot.LockedPage: - pywikibot.output(u"Page %s is locked?!" % page.aslink()) + pywikibot.output(u"Page %s is locked." + % page.title(asLink=True)) except pywikibot.PageNotSaved: - pywikibot.output(u"Page %s not saved" % page.aslink()) + pywikibot.output(u"Page %s not saved." + % page.title(asLink=True))
-def main(): + +def main(*args): # Disable cosmetic changes because we don't want to modify any page # content, so that we don't flood the histories with minor changes. config.cosmetic_changes = False @@ -66,7 +71,7 @@ # used to read the words from the page title. The words will later be # joined with spaces to retrieve the full title. pageTitle = [] - for arg in pywikibot.handleArgs(): + for arg in pywikibot.handleArgs(*args): if genFactory.handleArg(arg): continue if arg == '-redir': @@ -81,7 +86,7 @@ page = pywikibot.Page(pywikibot.getSite(), ' '.join(pageTitle)) gen = iter([page]) else: - pywikibot.showHelp('touch') + pywikibot.showHelp() return preloadingGen = pagegenerators.PreloadingGenerator(gen) bot = TouchBot(preloadingGen, redirs)
pywikipedia-svn@lists.wikimedia.org