http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10034
Revision: 10034 Author: valhallasw Date: 2012-03-21 17:40:12 +0000 (Wed, 21 Mar 2012) Log Message: ----------- Added 'view in web browser' option to add_text.py
Patch by Michael Thibault phoenixca@users.sourceforge.net Reference: pywikipediabot-Patches-3477090
Modified Paths: -------------- trunk/pywikipedia/add_text.py
Modified: trunk/pywikipedia/add_text.py =================================================================== --- trunk/pywikipedia/add_text.py 2012-03-21 17:30:31 UTC (rev 10033) +++ trunk/pywikipedia/add_text.py 2012-03-21 17:40:12 UTC (rev 10034) @@ -77,6 +77,7 @@ import wikipedia as pywikibot from pywikibot import i18n import codecs, config +import webbrowser
# This is required for the text that is shown when you run this script # with the parameter -help. @@ -277,11 +278,17 @@ if not always: choice = pywikibot.inputChoice( u'Do you want to accept these changes?', - ['Yes', 'No', 'All'], ['y', 'N', 'a'], 'N') + ['Yes', 'No', 'All', 'open in Browser'], ['y', 'N', 'a', 'b'], 'N') if choice == 'a': always = True elif choice == 'n': return (False, False, always) + elif choice == 'b': + webbrowser.open("http://%s%s" % ( + page.site().hostname(), + page.site().nice_get_address(page.title()) + )) + pywikibot.input("Press Enter when finished in browser.") if always or choice == 'y': try: if always: