Skip to content

Commit 07be5d1

Browse files
committed
Fixed reuse of list convert
1 parent 5751473 commit 07be5d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

csbot/plugins/quote.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ def _quote(self, nick):
1818

1919
#find quote by nick
2020
quotes = self.db.find({'nick': nick})
21+
22+
#Find returns cursor, convert cursor iterator to list,
2123
quote_list = list(quotes)
2224

2325
if len(quote_list) == 0:
2426
self.QuoteError("No quotes by", nick)
2527

26-
#Find returns cursor, convert cursor to list, randomly pick quote from returned quotes
27-
quote_list = list(quotes)
28+
#Randomly pick quote from returned quotes
2829
quote = random.choice(quote_list)
2930

3031
return (quote["quote"], quote["nick"])

0 commit comments

Comments
 (0)