Beispiel #1
0
def save_session():
    from candidates_emailer.models import User, db

    access_token = odesk.get_access_token()
    u = odesk.get_client().hr.get_user("me")
    user = User(email=u.get("email"),
                first_name=u.get("first_name"),
                last_name=u.get("last_name"),
                access_token=access_token[0],
                access_token_secret=access_token[1])

    try:
        db.session.add(user)
        db.session.commit()
    except IntegrityError:
        #Update access token
        db.session.rollback()
        user = User.query.filter_by(email=user.email).first()
        user.access_token = access_token[0]
        user.access_token_secret = access_token[1]
        db.session.commit()

    session["user_id"] = user.id
    session["user"] = {
        "name": "{0}".format(user.full_name),
        "url": u.get("public_url")
        }
def save_session():
    u = odesk.get_client().hr.get_user("me")
    session["user"] = {
        "name": "{0} {1}".format(u.get("first_name"), u.get("last_name")),
        "url": u.get("public_url")
        }
Beispiel #3
0
def save_user_session():
    u = odesk.get_client().hr.get_user('me')
    session['user'] = {
        'name': u'%s %s' % (u.get('first_name'), u.get('last_name')),
        'url': u.get('public_url'),
    }
Beispiel #4
0
def team():
    c = odesk.get_client()
    teamrooms = c.team.get_teamrooms_2()
    teams = [t for t in teamrooms if not t.update({'snapshots': c.team.get_snapshots_2(t.get('id'), online='all')})]
    return render_template('team.html', teams=teams)