Example #1
0
 def get_by_id(post_id):
     s = Session()
     try:
         return s.query(Post).filter(Post.id == post_id).one()
     except NoResultFound:
         return None
Example #2
0
 def get_visible_posts():
     s = Session()
     return s.query(Post).filter(Post.is_visible == True).\
         order_by(Post.post_date.desc())
Example #3
0
 def get_by_id(comment_id):
     s = Session()
     try:
         return s.query(Comment).filter(Comment.id == comment_id).one()
     except NoResultFound:
         return None