Commit 525d52f8 authored by Guido van Rossum's avatar Guido van Rossum

Move the roulette() functionality out of the FaqDir class into the

FaqWizard class.
parent 46ff1903
...@@ -325,12 +325,6 @@ class FaqDir: ...@@ -325,12 +325,6 @@ class FaqDir:
sec, num = self.__okprog.group(1, 2) sec, num = self.__okprog.group(1, 2)
return string.atoi(sec), string.atoi(num) return string.atoi(sec), string.atoi(num)
def roulette(self):
self.__fill()
import whrandom
if not self.__files: return None
return whrandom.choice(self.__files)
def list(self): def list(self):
# XXX Caller shouldn't modify result # XXX Caller shouldn't modify result
self.__fill() self.__fill()
...@@ -577,10 +571,12 @@ class FaqWizard: ...@@ -577,10 +571,12 @@ class FaqWizard:
emit(TAIL_RECENT) emit(TAIL_RECENT)
def do_roulette(self): def do_roulette(self):
file = self.dir.roulette() import whrandom
if not file: files = self.dir.list()
if not files:
self.error("No entries.") self.error("No entries.")
return return
file = whrandom.choice(files)
self.prologue(T_ROULETTE) self.prologue(T_ROULETTE)
self.dir.show(file) self.dir.show(file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment