]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Move the roulette() functionality out of the FaqDir class into the
authorGuido van Rossum <guido@python.org>
Mon, 2 Jun 1997 22:52:37 +0000 (22:52 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 2 Jun 1997 22:52:37 +0000 (22:52 +0000)
FaqWizard class.

Tools/faqwiz/faqwiz.py

index 06e1ab5106c118a145dcb6cfcd65fecf68212103..804e6116bd6e5c56bfd47089703cf94dbba7ad18 100644 (file)
@@ -325,12 +325,6 @@ class FaqDir:
        sec, num = self.__okprog.group(1, 2)
        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):
        # XXX Caller shouldn't modify result
        self.__fill()
@@ -577,10 +571,12 @@ class FaqWizard:
        emit(TAIL_RECENT)
 
     def do_roulette(self):
-       file = self.dir.roulette()
-       if not file:
+       import whrandom
+       files = self.dir.list()
+       if not files: 
            self.error("No entries.")
            return
+       file = whrandom.choice(files)
        self.prologue(T_ROULETTE)
        self.dir.show(file)