示例#1
0
 def _view_posts(self):
     blog_to_see = input("Enter the blog_id you'd like to see: ")
     blog = Blog.get_blog_from_ID(
         blog_to_see)  #get a blog associated with this blog_id
     posts = blog.get_posts(
     )  #get a list of all Post() objects in that blog
     if posts is not None:
         for post in posts:
             print("Date: {}\nTitle: {}\nContent: {}\n\n".format(
                 post.created_date, post.title, post.content))
     else:
         print("No posts found")
示例#2
0
 def _user_has_account(self):
     """
     This method will return True if a user exists and set the self.user_blog object for the user if the user exists.
     Otherwise the method will return False
     :return:
     """
     blog_id = Blog.find_author_id(self.user)
     if blog_id is not None:
         self.user_blog = Blog.get_blog_from_ID(blog_id)
         return True
     else:
         return False