Revision: 7818
Author:   xqt
Date:     2009-12-23 07:30:29 +0000 (Wed, 23 Dec 2009)

Log Message:
-----------
use inputChoice()

Modified Paths:
--------------
    trunk/pywikipedia/blockpageschecker.py
    trunk/pywikipedia/solve_disambiguation.py

Modified: trunk/pywikipedia/blockpageschecker.py
===================================================================
--- trunk/pywikipedia/blockpageschecker.py      2009-12-23 06:53:31 UTC (rev 
7817)
+++ trunk/pywikipedia/blockpageschecker.py      2009-12-23 07:30:29 UTC (rev 
7818)
@@ -189,23 +189,15 @@
     return ('editable', r'\A\n') # If editable means that we have no regex, 
won't change anything with this regex
 
 def debugQuest(site, page):
-    quest = pywikibot.input(u'Do you want to open the page on your [b]rowser, 
[g]ui or [n]othing?')
+    quest = pywikibot.inputChoice(u'Do you want to open the page?',['with 
browser', 'with gui', 'no'], ['b','g','n'], 'n')
     pathWiki = site.family.nicepath(site.lang)
     url = 'http://%s%s%s?&redirect=no' % (pywikibot.getSite().hostname(), 
pathWiki, page.urlname())
-    while 1:
-        if quest.lower() in ['b', 'B']:
-            webbrowser.open(url)
-            break
-        elif quest.lower() in ['g', 'G']:
-            import editarticle
-            editor = editarticle.TextEditor()
-            text = editor.edit(page.get())
-            break
-        elif quest.lower() in ['n', 'N']:
-            break
-        else:
-            pywikibot.output(u'wrong entry, type "b", "g" or "n"')
-            continue
+    if quest == 'b':
+        webbrowser.open(url)
+    elif quest == 'g':
+        import editarticle
+        editor = editarticle.TextEditor()
+        text = editor.edit(page.get())
 
 def main():
     """ Main Function """

Modified: trunk/pywikipedia/solve_disambiguation.py
===================================================================
--- trunk/pywikipedia/solve_disambiguation.py   2009-12-23 06:53:31 UTC (rev 
7817)
+++ trunk/pywikipedia/solve_disambiguation.py   2009-12-23 07:30:29 UTC (rev 
7818)
@@ -649,11 +649,11 @@
 
                     if not self.always:
                         if edited:
-                            choice = pywikibot.input(u"Option (#, r#, s=skip 
link, e=edit page, n=next page, u=unlink, q=quit\n"
-                                               "        m=more context, 
l=list, a=add new, x=save in this form):")
+                            choice = pywikibot.input(u"Option (#, r#, [s]kip 
link, [e]dit page, [n]ext page, [u]nlink, [q]uit\n"
+                                               "        [m]ore context, 
[l]ist, [a]dd new, x=save in this form):")
                         else:
-                            choice = pywikibot.input(u"Option (#, r#, s=skip 
link, e=edit page, n=next page, u=unlink, q=quit\n"
-                                               "        m=more context, d=show 
disambiguation page, l=list, a=add new):")
+                            choice = pywikibot.input(u"Option (#, r#, [s]kip 
link, [e]dit page, [n]ext page, [u]nlink, [q]uit\n"
+                                               "        [m]ore context, show 
[d]isambiguation page, [l]ist, [a]dd new):")
                     else:
                         choice = self.always
                     if choice in ['a', 'A']:



_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to