diff options
author | cedricbonhomme <devnull@localhost> | 2012-03-04 09:06:43 +0100 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2012-03-04 09:06:43 +0100 |
commit | 143de38d7e50e23f6f8d7977692b218f45c6753d (patch) | |
tree | e00780689b4ea268f22363ea01d269630c2da31e /mongodb.py | |
parent | Removed useless code concerning SQLite and the update method (inotify) on the... (diff) | |
download | newspipe-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.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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): |