Exemplo n.º 1
0
    def setUp(self):
        mysql_session.flush()
        mysql_session.close()
        r_server.flushdb()

        Activity.__table__.drop(mysql_engine, checkfirst=True)
        Activity.__table__.create(mysql_engine, checkfirst=True)

        Board.__table__.drop(mysql_engine, checkfirst=True)
        Board.__table__.create(mysql_engine, checkfirst=True)
Exemplo n.º 2
0
 def add(cls, title, board_id):
     _list = cls(board_id = board_id, title = title)
     try:
         mysql_session.add(_list)
         mysql_session.commit()
     except Exception as e:
         mysql_session.rollback()
         raise
         print "error in mysql commit:", e
     finally:
         mysql_session.close()
     return _list.id
Exemplo n.º 3
0
    def add(cls, board_id, user_id, content):
        activity = cls(board_id = board_id, user_id = user_id, content = content)
        try:
            mysql_session.add(activity)
            mysql_session.commit()
        except Exception as e:
            mysql_session.rollback()
            print "error in mysql commit:", e
            raise
        finally:
            mysql_session.close()

        return activity.id
Exemplo n.º 4
0
    def add(cls, title, visibility, ): #no group_id for now
        board = cls(title = title, visibility = visibility) #no group_id = group_id
        try:
            mysql_session.add(board)
            mysql_session.commit()
        except Exception as e:
            mysql_session.rollback()
            print "error in mysql commit:", e
            raise
        finally:
            mysql_session.close()

        return board.id
Exemplo n.º 5
0
    def add(cls, card_id, user_id, content):
        comment = cls(card_id = card_id, user_id = user_id, content = content)
        from models.card import Card
        Card.incr_comment(card_id)
        try:
            mysql_session.add(comment)
            mysql_session.commit()
        except Exception as e:
            mysql_session.rollback()
            print "error in mysql commit:", e
            raise
        finally:
            mysql_session.close()

        return comment.id
Exemplo n.º 6
0
    def add(cls, username, unsafe_password, user_email):
        safe_password = generate_password_hash(unsafe_password)
        user = User(username=username,
                    password=safe_password, 
                    email=user_email)
        try:
            mysql_session.add(user)
            mysql_session.commit()
        except Exception as e:
            mysql_session.rollback()
            print e
            raise
        finally:
            mysql_session.close()

        return user.id