def get_user_by_username(app, username):
 sa_session = app.model.context.current
 try:
  user = sa_session.query(app.model.User).filter((app.model.User.table.c.username == username)).one()
  return user
 except Exception:
  return None

def get_user_by_username ( app , username ) : sa_session = app . model . context . current try : user = sa_session . query ( app . model . User ) . filter ( ( app . model . User . table . c . username == username ) ) . one ( ) return user except Exception : return None
get a user from the database by username .