aboutsummaryrefslogtreecommitdiff
path: root/mongodb.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-03-04 09:06:43 +0100
committercedricbonhomme <devnull@localhost>2012-03-04 09:06:43 +0100
commit143de38d7e50e23f6f8d7977692b218f45c6753d (patch)
treee00780689b4ea268f22363ea01d269630c2da31e /mongodb.py
parentRemoved useless code concerning SQLite and the update method (inotify) on the... (diff)
downloadnewspipe-143de38d7e50e23f6f8d7977692b218f45c6753d.tar.gz
newspipe-143de38d7e50e23f6f8d7977692b218f45c6753d.tar.bz2
newspipe-143de38d7e50e23f6f8d7977692b218f45c6753d.zip
Unread articles page is now completely working. Improvements of the get_articles_from_collection() function in mongodb.py, the function takes now an aditional argument in order to filter the result.
Diffstat (limited to 'mongodb.py')
-rw-r--r--mongodb.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mongodb.py b/mongodb.py
index 2da229c8..1f74d164 100644
--- a/mongodb.py
+++ b/mongodb.py
@@ -80,12 +80,15 @@ class Articles(object):
feeds = sorted(feeds, key=itemgetter('feed_title'))
return feeds
- def get_articles_from_collection(self, feed_id):
+ def get_articles_from_collection(self, feed_id, condition=None):
"""
Return all the articles of a collection.
"""
collection = self.db[str(feed_id)]
- cursor = collection.find({"type":1})
+ if condition is None:
+ cursor = collection.find({"type":1})
+ else:
+ cursor = collection.find({"type":1, condition[0]:condition[1]})
return cursor.sort([("article_date", pymongo.DESCENDING)])
def print_articles_from_collection(self, collection_id):
bgstack15