Example #1
0
def track_logout(sender, user, **extra):
    session = DBSession()
    user.active = False
    session.add(user)
    session.commit()
Example #2
0
def track_login(sender, user, **extra):
    session = DBSession()
    user.active = True
    session.add(user)
    session.commit()
Example #3
0
 def add(cls, account, password):
     session = DBSession()
     user = cls(account=account, active=False)
     user.hash_password(password)
     session.add(user)
     session.flush()
Example #4
0
 def get_account(cls, account):
     return DBSession().query(cls).filter(cls.account == account).first()
Example #5
0
 def get_user_by_id(cls, user_id):
     return DBSession().query(cls).filter(cls.id == user_id).first()
Example #6
0
 def add_blog(cls, topic, genre, content):
     session = DBSession()
     blog = cls(topic=topic, genre=genre, content=content)
     session.add(blog)
     session.flush()