]> gitweb.pimeys.fr Git - bots/parrot.git/blobdiff - quotes.py
!from : quote aléatoire en faisant une recherche sur l'auteur
[bots/parrot.git] / quotes.py
index bd05913fe316a4bf980fd09adf07f58460788d50..fae0df089c31212721df79c84991a264f29dd80a 100644 (file)
--- a/quotes.py
+++ b/quotes.py
@@ -101,9 +101,12 @@ class QuoteDB(object):
     def random(self):
         """ Sort une quote aléatoire """
         return random.choice(self.quotelist)
+    def quotesfrom(self, author):
+        """ Sort toutes les quotes de ``author`` """
+        return [q for q in self.quotelist if q.author == author]
     def randomfrom(self, author):
         """ Sort une quote aléatoire de ``author`` """
-        return random.choice([q for q in self.quotelist if q.author == author])
+        return random.choice(self.quotesfrom(author))
     
     def search(self, inquote=None, author=None, regexp=False):
         """Fait une recherche dans les quotes."""