diff options
author | cedricbonhomme <devnull@localhost> | 2012-03-04 00:26:33 +0100 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2012-03-04 00:26:33 +0100 |
commit | f65f4e936e890dea064628d1a457f0db93ceb757 (patch) | |
tree | a3f14c4d7034b7a0d920c35772e0ec9ed0b22dc6 /mongodb.py | |
parent | Mark all articles as read (from the main page) is working. (diff) | |
download | newspipe-f65f4e936e890dea064628d1a457f0db93ceb757.tar.gz newspipe-f65f4e936e890dea064628d1a457f0db93ceb757.tar.bz2 newspipe-f65f4e936e890dea064628d1a457f0db93ceb757.zip |
Notifications page is working. Improved get_all_collections function.
Diffstat (limited to 'mongodb.py')
-rw-r--r-- | mongodb.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -64,14 +64,17 @@ class Articles(object): collection = self.db[str(feed_id)] return collection.find({"article_id":article_id}).next() - def get_all_collections(self): + def get_all_collections(self, condition=None): """ """ feeds = [] collections = self.db.collection_names() for collection_name in collections: if collection_name != "system.indexes": - cursor = self.db[collection_name].find({"type":0}) + if condition is None: + cursor = self.db[collection_name].find({"type":0}) + else: + cursor = self.db[collection_name].find({"type":0, condition[0]:condition[1]}) if cursor.count() != 0: feeds.append(cursor.next()) feeds = sorted(feeds, key=itemgetter('feed_title')) |