diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-11-17 00:00:12 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-11-17 00:00:12 +0100 |
commit | 5d1ffedb84affe9d9d4e73676f713de2c0a87017 (patch) | |
tree | 430b6c1238eb83b2c17890e1efc91cd2590505c6 /pyaggr3g470r/models.py | |
parent | Updated about page. (diff) | |
download | newspipe-5d1ffedb84affe9d9d4e73676f713de2c0a87017.tar.gz newspipe-5d1ffedb84affe9d9d4e73676f713de2c0a87017.tar.bz2 newspipe-5d1ffedb84affe9d9d4e73676f713de2c0a87017.zip |
Removed old module for the MongoDB connection.
Diffstat (limited to 'pyaggr3g470r/models.py')
-rw-r--r-- | pyaggr3g470r/models.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/pyaggr3g470r/models.py b/pyaggr3g470r/models.py index 1a573ca2..38d1e6ec 100644 --- a/pyaggr3g470r/models.py +++ b/pyaggr3g470r/models.py @@ -96,41 +96,3 @@ class Article(Document): def __str__(self): return 'Article: %s' % self.title - -if __name__ == "__main__": - # Point of entry in execution mode - db = connect('pyaggr3g470r1') - db.drop_database('pyaggr3g470r1') - - - from werkzeug import generate_password_hash - password = generate_password_hash("admin") - user1 = User(firstname="Cédric", lastname="Bonhomme", \ - email="kimble.mandel@gmail.com", pwdhash=generate_password_hash("admin")) - user1.save() - - import mongodb - mongo = mongodb.Articles("127.0.0.1", 27017, \ - "pyaggr3g470r", "***", "") - feeds = mongo.get_all_feeds() - for feed in feeds: - articles = [] - feed_articles = mongo.get_articles(feed["feed_id"]) - feed_articles = sorted(feed_articles, key=lambda t: t['article_date'], reverse=True) - for article in feed_articles: - article1 = Article(date=article["article_date"], link=article["article_link"], \ - title=article["article_title"], content=article["article_content"], \ - readed=article["article_readed"], like=article["article_like"], \ - retrieved_date=article["article_date"]) - - articles.append(article1) - article1.save() - - sorted(articles, key=lambda t: t.date, reverse=True) - - feed1 = Feed(title=feed["feed_title"], link=feed["feed_link"], - site_link=feed["site_link"], mail=feed["mail"], - articles=articles) - #feed1.save() - user1.feeds.append(feed1) - user1.save()
\ No newline at end of file |