diff options
author | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-03-04 07:48:14 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel+bitbucket@gmail.com> | 2015-03-04 07:48:14 +0100 |
commit | 1c0ba8fad47489ce987e628605fd106f981d8075 (patch) | |
tree | b381e4c8c910b2f2f282f6dadbda1a8c1938e358 /pyaggr3g470r/controllers/article.py | |
parent | Typo. (diff) | |
parent | adding refresh rate to the profile form (diff) | |
download | newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.tar.gz newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.tar.bz2 newspipe-1c0ba8fad47489ce987e628605fd106f981d8075.zip |
Merged in jaesivsm/pyaggr3g470r/evol/api (pull request #6)
Evolution Arch, API and new crawler
Diffstat (limited to 'pyaggr3g470r/controllers/article.py')
-rw-r--r-- | pyaggr3g470r/controllers/article.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pyaggr3g470r/controllers/article.py b/pyaggr3g470r/controllers/article.py new file mode 100644 index 00000000..46ca0988 --- /dev/null +++ b/pyaggr3g470r/controllers/article.py @@ -0,0 +1,27 @@ +import conf +from .abstract import AbstractController +from pyaggr3g470r.models import Article + + +class ArticleController(AbstractController): + _db_cls = Article + + def get(self, **filters): + article = super(ArticleController, self).get(**filters) + if not article.readed: + self.update({'id': article.id}, {'readed': True}) + return article + + def delete(self, obj_id): + obj = super(ArticleController, self).delete(obj_id) + if not conf.ON_HEROKU: + import pyaggr3g470r.search as fastsearch + fastsearch.delete_article(self.user_id, obj.feed_id, obj_id) + return obj + + def challenge(self, ids): + """Will return each id that wasn't found in the database.""" + for id_ in ids: + if self.read(**id_).first(): + continue + yield id_ |