Beispiel #1
0
 def _user_has_account(self):
     blog = Database.find_one('blogs', {'Author': self.user})
     if blog is not None:
         self.user_blog = Blog.get_from_mongo(blog['Blog_id'])
         return True
     else:
         return False
Beispiel #2
0
 def _view_blog(self):
     blog_to_see = input("Enter ID of your blog you like it to read")
     blog = Blog.get_from_mongo(blog_to_see)
     posts = blog.get_posts()
     for post in posts:
         print("Date : {}, Tittle: {}\n\n{}".format(post['date'],
                                                    post['tittle'],
                                                    post['content']))
Beispiel #3
0
 def _view_blog():
     blog_to_see = input("Enter the ID of the blog you'd like to read: ")
     blog = Blog.get_from_mongo(blog_to_see)
     posts = blog.get_posts()
     for post in posts:
         print("Date: {}, title: {}\n\n{}".format(post['Created_date'],
                                                  post['Title'],
                                                  post['Content']))
Beispiel #4
0
 def _user_has_account(self):
     datainfoblog = Database.find_one(
         'blogs',
         {'author': self.user
          })  # Check in database if user exists, and throws a boolean
     if datainfoblog is not None:
         self.user_blog = Blog.get_from_mongo(datainfoblog['id'])
         return True
     else:
         return False
Beispiel #5
0
 def _view_blog(self):
     blog_to_see = raw_input(
         "Enter the ID of the blog you'd like to read: ")
     blog = Blog.get_from_mongo(blog_to_see)
     print 'Blog returned:', blog
     posts = blog.get_posts()
     for post in posts:
         print 'Date: ', post['created_date']
         print 'Title: ', post['title']
         print ''
         print post['content']