Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 525d52f

Browse files
committed
Move the roulette() functionality out of the FaqDir class into the
FaqWizard class.
1 parent 46ff190 commit 525d52f

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

Tools/faqwiz/faqwiz.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,6 @@ def parse(self, file):
325325
sec, num = self.__okprog.group(1, 2)
326326
return string.atoi(sec), string.atoi(num)
327327

328-
def roulette(self):
329-
self.__fill()
330-
import whrandom
331-
if not self.__files: return None
332-
return whrandom.choice(self.__files)
333-
334328
def list(self):
335329
# XXX Caller shouldn't modify result
336330
self.__fill()
@@ -577,10 +571,12 @@ def do_recent(self):
577571
emit(TAIL_RECENT)
578572

579573
def do_roulette(self):
580-
file = self.dir.roulette()
581-
if not file:
574+
import whrandom
575+
files = self.dir.list()
576+
if not files:
582577
self.error("No entries.")
583578
return
579+
file = whrandom.choice(files)
584580
self.prologue(T_ROULETTE)
585581
self.dir.show(file)
586582

0 commit comments

Comments
 (0)