mirror of
https://github.com/python/cpython.git
synced 2025-07-13 06:15:17 +00:00
Protect roulette against empty FAQ.
This commit is contained in:
parent
00494bfa15
commit
72a342fd4f
1 changed files with 5 additions and 1 deletions
|
@ -328,6 +328,7 @@ class FaqDir:
|
|||
def roulette(self):
|
||||
self.__fill()
|
||||
import whrandom
|
||||
if not self.__files: return None
|
||||
return whrandom.choice(self.__files)
|
||||
|
||||
def list(self):
|
||||
|
@ -576,8 +577,11 @@ class FaqWizard:
|
|||
emit(TAIL_RECENT)
|
||||
|
||||
def do_roulette(self):
|
||||
self.prologue(T_ROULETTE)
|
||||
file = self.dir.roulette()
|
||||
if not file:
|
||||
self.error("No entries.")
|
||||
return
|
||||
self.prologue(T_ROULETTE)
|
||||
self.dir.show(file)
|
||||
|
||||
def do_help(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue