[hamster-applet] allow category_id to be a list



commit 4de3319e090f0e872c02672df500b7b3015f786f
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Jul 12 18:13:19 2009 +0100

    allow category_id to be a list

 hamster/db.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/hamster/db.py b/hamster/db.py
index ac7b23e..2e355c4 100644
--- a/hamster/db.py
+++ b/hamster/db.py
@@ -447,8 +447,10 @@ class Storage(storage.Storage):
                     WHERE (a.end_time >= ? OR a.end_time IS NULL) AND a.start_time <= ?
         """
         
-        if category_id:
+        if category_id and isinstance(category_id, int):
             query += " and b.category_id = %d" % category_id
+        elif category_id and isinstance(category_id, list):
+            query += " and b.category_id IN (%s)" % (",".join([str(id) for id in category_id]))
 
         query += " ORDER BY a.start_time"
         end_date = end_date or date



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]